#include "system/includes.h"
extern u32 UPDATA_BEG;
u32 g_updata_flag = 0;
const char log_tag_const_i_HEAP_MEM __attribute__((section(".LOG_TAG_CONST"))) = (0 & 0);
const char log_tag_const_d_HEAP_MEM __attribute__((section(".LOG_TAG_CONST"))) = (1 & 0);
const char log_tag_const_e_HEAP_MEM __attribute__((section(".LOG_TAG_CONST"))) = (1 & 0);
const char log_tag_const_d_SYS_TMR __attribute__((section(".LOG_TAG_CONST"))) = (0 & 0);
const char log_tag_const_e_SYS_TMR __attribute__((section(".LOG_TAG_CONST"))) = (1 & 0);
const char log_tag_const_i_VM __attribute__((section(".LOG_TAG_CONST"))) = (1 & 0);
const char log_tag_const_i_TMR __attribute__((section(".LOG_TAG_CONST"))) = (0 & 0);
const char log_tag_const_i_LRC __attribute__((section(".LOG_TAG_CONST"))) = (0 & 0);
const char log_tag_const_i_CLOCK __attribute__((section(".LOG_TAG_CONST"))) = (0 & 0);
const char log_tag_const_i_PMU __attribute__((section(".LOG_TAG_CONST"))) = (1 & 0);
const char log_tag_const_d_PMU __attribute__((section(".LOG_TAG_CONST"))) = (0 & 0);
const char log_tag_const_i_LP_TIMER __attribute__((section(".LOG_TAG_CONST"))) = (0 & 0);
const int SDFILE_VFS_REDUCE_ENABLE = 0;
const int VIRFAT_FLASH_ENABLE = 0;
const int config_printf_time = 1;
const int config_asser = 0;
const int vm_max_size_config = 64*1024;
const int clock_sys_src_use_lrc_hw = 0;
const int config_update_mode = (1UL << (0)) | (1UL << (1)) | (1UL << (2)) | (1UL << (3));
const int support_vm_data_keep = 0;
typedef enum {
UPDATA_NON = (0x5A00),
UPDATA_READY,
UPDATA_SUCC,
UPDATA_PARM_ERR,
UPDATA_DEV_ERR,
UPDATA_KEY_ERR,
} UPDATA_RESULT;
u8 is_pwm_led_on(void) {
return (((JL_PLED_TypeDef *)(0x1e0000 + ((64 * 0x52 + 0x00) * 4)))->CON0 & (1UL << (0)));
}
void app_bank_init() {}
const struct btif_item btif_table[] = {
{102, 6 },
{110, 6 },
{0, 0 },
};
typedef struct _UPDATA_PARM {
u16 parm_crc;
u16 parm_type;
u16 parm_result;
u16 magic;
u8 file_patch[32];
u8 parm_priv[32];
u32 ota_addr;
u16 ext_arg_len;
u16 ext_arg_crc;
} UPDATA_PARM;
u16 update_result_get(void) {
u16 ret = UPDATA_NON;
if (!(config_update_mode == 0)) {
UPDATA_PARM *p = ((void *)((u32)&UPDATA_BEG + 0x08));
u16 crc_cal;
crc_cal = CRC16(((u8 *)p) + 2, sizeof(UPDATA_PARM) - 2);
if (crc_cal && crc_cal == p->parm_crc) {
ret = p->parm_result;
}
g_updata_flag = ret;
g_updata_flag |= ((u32)(p->magic)) << 16;
memset(p, 0x00, sizeof(UPDATA_PARM));
}
return ret;
}
const struct task_info task_info_table[] = {
{"app_core", 1, 896, 768 },
{"sys_event", 6, 256, 0 },
{"btctrler", 4, 512, 384 },
{"btencry", 1, 512, 128 },
{"btstack", 3, 384, 256 },
{"audio_dec", 3, 768 + 32, 128 },
{"audio_enc", 3, 512, 128 },
{"aec", 2, 768, 0 },
{"aec_dbg", 3, 128, 128 },
{"update", 1, 512, 0 },
{"systimer", 6, 128, 0 },
{"dev_mg", 3, 512, 512 },
{"usb_msd", 1, 512, 128 },
{"usb_audio", 5, 256, 256 },
{"plnk_dbg", 5, 256, 256 },
{"adc_linein", 2, 768, 128 },
{"fm_task", 3, 512, 128 },
{"enc_write", 1, 768, 0 },
{"ui", 3, 384 - 64, 128 },
{"mic_stream", 5, 768, 128 },
{0, 0},
};
int file_comm_long_name_fix(u8 *str, u16 len) {
u8 *src = str;
while (len > 1) {
if ((*str == 0xff) && (*(str + 1) == 0xff)) {
break;
}
if ((*str == 0x0) && (*(str + 1) == 0x0)) {
break;
}
str += 2;
len -= 2;
}
*str = 0x00;
*(str + 1) = 0x00;
return (int)(str - src);
}
#define LED_BUILTIN IO_PORTC_05
#define MUTE_PIN IO_PORTA_03 // debug
#define KEY_PIN IO_PORTA_04 // adc
#define PORTC_BASE 0x01E5080
#define PORTC_DATA_REG (*(volatile unsigned int *)(PORTC_BASE + 0x0))
void (*os_start_ptr)() = 0x117d68;
void (*os_init_ptr)() = 0x117d64;
#define OUTPUT 0
#define HIGH 1
#define LOW 0
extern tick_timer_init();
static void app_task_handler(void *p) {
gpio_direction_output(LED_BUILTIN, OUTPUT);
while (1) {
PORTC_DATA_REG |= (1 << 5); // IO_PORTC_05
os_time_dly(100);
PORTC_DATA_REG &= ~(1 << 5); // IO_PORTC_05
os_time_dly(100);
}
}
BaseType_t xTaskCreate(
TaskFunction_t pxTaskCode, // Pointer to the task function
const char * const pcName, // A descriptive name for the task (useful for debugging)
uint16_t usStackDepth, // Stack size for the task (in words, not bytes)
void *pvParameters, // Parameters to pass to the task (if any)
UBaseType_t uxPriority, // Task priority (higher number means higher priority)
TaskHandle_t *pxCreatedTask // Pointer to a TaskHandle_t variable to receive the task handle
);
int main() {
os_init_ptr();
memory_init();
clk_early_init(SYS_CLOCK_INPUT_PLL_BT_OSC, 24000000, 24000000);
tick_timer_init();
xTaskCreate(app_task_handler, "LED Task", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 1, NULL);
os_start_ptr();
while (1) asm("idle");
return 0;
}