[refactor] remove bflb_platform.h from bl602 and bl702 driver,include it in anywhere used
This commit is contained in:
parent
e212f9de4a
commit
9c67a54e24
@ -8,8 +8,6 @@ PROJECT(${BOARD} C CXX ASM)
|
||||
# set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||
ENABLE_LANGUAGE(ASM)
|
||||
|
||||
include_directories(${CMAKE_SOURCE_DIR}/common/misc)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/drivers/${CHIP}_driver/risc-v/Core/Include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/bsp/bsp_common/platform)
|
||||
|
||||
if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/bsp/board/${CHIP})
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "hal_clock.h"
|
||||
#include "bl602_glb.h"
|
||||
#include "bl602_config.h"
|
||||
#include "bflb_platform.h"
|
||||
|
||||
struct pin_mux_cfg {
|
||||
uint8_t pin;
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "hal_clock.h"
|
||||
#include "bl702_glb.h"
|
||||
#include "bl702_config.h"
|
||||
#include "bflb_platform.h"
|
||||
|
||||
struct pin_mux_cfg {
|
||||
uint8_t pin;
|
||||
|
@ -433,7 +433,7 @@ void ES8388_I2C_Init(void)
|
||||
* @return None
|
||||
*
|
||||
*******************************************************************************/
|
||||
BL_Err_Type ES8388_Reg_Dump(void)
|
||||
void ES8388_Reg_Dump(void)
|
||||
{
|
||||
int i;
|
||||
uint8_t tmp;
|
||||
@ -446,7 +446,6 @@ BL_Err_Type ES8388_Reg_Dump(void)
|
||||
bflb_platform_printf("Reg[%02d]=0x%02x \n", i, tmp);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/*@} end of group ES8388_Private_Functions */
|
||||
|
@ -181,7 +181,7 @@ typedef struct
|
||||
* @{
|
||||
*/
|
||||
void ES8388_Init(ES8388_Cfg_Type *cfg);
|
||||
BL_Err_Type ES8388_Reg_Dump(void);
|
||||
void ES8388_Reg_Dump(void);
|
||||
int ES8388_Set_Voice_Volume(int volume);
|
||||
|
||||
/*@} end of group ES8388_Public_Functions */
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "hal_emac.h"
|
||||
#include <FreeRTOS.h>
|
||||
#include "semphr.h"
|
||||
|
||||
#include "bflb_platform.h"
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/* Network interface name */
|
||||
|
@ -20,7 +20,7 @@
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "bflb_platform.h"
|
||||
#include "bsp_il9341.h"
|
||||
#include "hal_spi.h"
|
||||
#include "hal_dma.h"
|
||||
@ -625,7 +625,7 @@ void LCD_DrawChinese(uint16_t x, uint16_t y, uint8_t *character, uint16_t bk_col
|
||||
// color为字体颜色,bk_color为背景颜色,num为最大显示数量(汉字算两个)
|
||||
void LCD_DrawFont(uint16_t x, uint16_t y, uint16_t color, uint16_t bk_color, uint8_t *str, uint8_t num)
|
||||
{
|
||||
uint8_t i, j, k, l, x0 = x;
|
||||
uint8_t i, j, k, x0 = x;
|
||||
uint8_t temp, m;
|
||||
|
||||
for (i = 0; i < num && *str; i++, str++) {
|
||||
@ -701,7 +701,7 @@ void LCD_DrawFont(uint16_t x, uint16_t y, uint16_t color, uint16_t bk_color, uin
|
||||
|
||||
void LCD_DrawFont_64x32(uint16_t x, uint16_t y, uint16_t color, uint16_t bk_color, uint8_t *str, uint8_t num)
|
||||
{
|
||||
uint16_t i, j, k, l, x0 = x;
|
||||
uint16_t i, j, k, x0 = x;
|
||||
uint8_t temp, m;
|
||||
|
||||
for (i = 0; i < num && *str; i++, str++) {
|
||||
|
@ -20,6 +20,7 @@
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
#include "bflb_platform.h"
|
||||
#include "bsp_image_sensor.h"
|
||||
#include "bl702_glb.h"
|
||||
#include "hal_gpio.h"
|
||||
|
@ -52,7 +52,7 @@ int lcd_auto_swap_set(uint8_t flag)
|
||||
* @param color_num color num
|
||||
* @return int
|
||||
*/
|
||||
int lcd_swap_color_data16(uint16_t *dst, uint16_t *src, size_t color_num)
|
||||
int lcd_swap_color_data16(uint16_t *dst, uint16_t *src, uint32_t color_num)
|
||||
{
|
||||
for (size_t i = 0; i < color_num; i++) {
|
||||
dst[i] = (src[i] << 8) | (src[i] >> 8);
|
||||
|
@ -61,7 +61,7 @@ extern struct device *lcd_dev_ifs;
|
||||
extern uint8_t lcd_auto_swap_flag;
|
||||
|
||||
int lcd_auto_swap_set(uint8_t flag);
|
||||
int lcd_swap_color_data16(uint16_t *dst, uint16_t *src, size_t num);
|
||||
int lcd_swap_color_data16(uint16_t *dst, uint16_t *src, uint32_t num);
|
||||
int lcd_init(void);
|
||||
int lcd_set_dir(uint8_t dir, uint8_t mir_flag);
|
||||
int lcd_get_dir();
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "hal_spi.h"
|
||||
#include "hal_gpio.h"
|
||||
#include "font.h"
|
||||
#include "bflb_platform.h"
|
||||
|
||||
#define SSD1306_USING_I2C 0
|
||||
#define SSD1306_USING_SPI 1
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "drv_mmheap.h"
|
||||
#include "hal_common.h"
|
||||
#include "ring_buffer.h"
|
||||
#include "bflb_platform.h"
|
||||
|
||||
extern uint32_t __HeapBase;
|
||||
extern uint32_t __HeapLimit;
|
||||
|
@ -28,8 +28,12 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "misc.h"
|
||||
//#include "mcu_sdk_version.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define MSG(a, ...) bflb_platform_printf(a, ##__VA_ARGS__)
|
||||
#define MSG_DBG(a, ...) bflb_platform_printf(a, ##__VA_ARGS__)
|
||||
@ -78,13 +82,6 @@ extern "C" {
|
||||
#define LOG_E(fmt, ...) dbg_log_line("E", 31, fmt, ##__VA_ARGS__)
|
||||
#define LOG_RAW(...) bflb_platform_printf(__VA_ARGS__)
|
||||
|
||||
#ifdef DEBUG
|
||||
void check_failed(uint8_t *file, uint32_t line);
|
||||
#define CHECK_PARAM(expr) ((expr) ? (void)0 : check_failed((uint8_t *)__FILE__, __LINE__))
|
||||
#else
|
||||
#define CHECK_PARAM(expr) ((void)0)
|
||||
#endif /* DEBUG */
|
||||
|
||||
void bflb_platform_init(uint32_t baudrate);
|
||||
void bflb_platform_printf(char *fmt, ...);
|
||||
void bflb_platform_print_set(uint8_t disable);
|
||||
|
@ -20,7 +20,7 @@
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "bflb_platform.h"
|
||||
#include "hal_spi.h"
|
||||
#include "hal_gpio.h"
|
||||
#include "hal_dma.h"
|
||||
|
@ -20,7 +20,7 @@
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "bflb_platform.h"
|
||||
#include "hal_gpio.h"
|
||||
#include "uart_interface.h"
|
||||
#include "hal_usb.h"
|
||||
|
@ -20,9 +20,9 @@
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "wm8978.h"
|
||||
#include "bflb_platform.h"
|
||||
#include "hal_i2c.h"
|
||||
#include "bsp_wm8978.h"
|
||||
|
||||
struct device *wm8978_i2c = NULL;
|
||||
|
@ -23,7 +23,8 @@
|
||||
|
||||
#ifndef __WM8978_H
|
||||
#define __WM8978_H
|
||||
#include "bflb_platform.h"
|
||||
|
||||
#include "stdint.h"
|
||||
|
||||
#define WM8978_ADDR 0X1A
|
||||
|
@ -302,7 +302,26 @@ void *mmheap_realloc(struct heap_info *pRoot, void *src_addr, size_t want_size)
|
||||
}
|
||||
return pReturn;
|
||||
}
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param pRoot
|
||||
* @param num
|
||||
* @param size
|
||||
* @return void*
|
||||
*/
|
||||
void *mmheap_calloc(struct heap_info *pRoot, size_t num, size_t size)
|
||||
{
|
||||
void *pReturn = NULL;
|
||||
|
||||
pReturn = (void *)mmheap_alloc(pRoot, size * num);
|
||||
|
||||
if (pReturn) {
|
||||
memset(pReturn, 0, num * size);
|
||||
}
|
||||
|
||||
return pReturn;
|
||||
}
|
||||
/**
|
||||
* @brief mmheap_free
|
||||
*
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "bflb_platform.h"
|
||||
|
||||
#ifndef MMHEAP_LOCK
|
||||
#define MMHEAP_LOCK()
|
||||
@ -39,12 +38,12 @@
|
||||
#ifndef MMHEAP_ASSERT
|
||||
#define MMHEAP_ASSERT(A) \
|
||||
if (!(A)) \
|
||||
bflb_platform_printf("mmheap malloc error:drv_mmheap,%d\r\n", __LINE__)
|
||||
printf("mmheap malloc error:drv_mmheap,%d\r\n", __LINE__)
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef MMHEAP_MALLOC_FAIL
|
||||
#define MMHEAP_MALLOC_FAIL() bflb_platform_printf("mmheap malloc fail:drv_mmheap,%d\r\n", __LINE__)
|
||||
#define MMHEAP_MALLOC_FAIL() printf("mmheap malloc fail:drv_mmheap,%d\r\n", __LINE__)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -117,6 +116,23 @@ void *mmheap_alloc(struct heap_info *pRoot, size_t want_size);
|
||||
* @return the new pointer to the allocated memory.
|
||||
*/
|
||||
void *mmheap_realloc(struct heap_info *pRoot, void *src_addr, size_t want_size);
|
||||
/**
|
||||
* @brief Cealloc memory from the heap.
|
||||
* Change the size of the memory block pointed to by ptr to size bytes.
|
||||
*
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li> if ptr is NULL, then the call is equivalent to mmheap_alloc(size), for all values of size.
|
||||
* <li> if ptr is if size is equal to zero, and ptr is not NULL, then the call is equivalent to mmheap_free(ptr).
|
||||
* </ul>
|
||||
*
|
||||
* @param[in] pRoot heap info.
|
||||
* @param[in] num size number.
|
||||
* @param[in] size new size of the memory space.
|
||||
*
|
||||
* @return the new pointer to the allocated memory.
|
||||
*/
|
||||
void *mmheap_calloc(struct heap_info *pRoot, size_t num, size_t size);
|
||||
/**
|
||||
* @brief Free the memory.
|
||||
* Free the memory space pointed to by ptr, which must have been returned by a previous call to mmheap_alloc(), mmheap_aligned_alloc(), or mmheap_realloc().
|
||||
|
@ -40,7 +40,7 @@
|
||||
}
|
||||
|
||||
/* Std driver attribute macro*/
|
||||
#ifndef BFLB_USE_CUSTOM_LD_SECTIONS
|
||||
#ifndef BFLB_USE_CUSTOM_LD_SECTIONS
|
||||
//#define ATTR_UNI_SYMBOL
|
||||
#define ATTR_STRINGIFY(x) #x
|
||||
#define ATTR_TOSTRING(x) ATTR_STRINGIFY(x)
|
||||
|
@ -43,6 +43,13 @@
|
||||
#define CHECK_PARAM(expr) ((void)0)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Null Type definition
|
||||
*/
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Error type definition
|
||||
*/
|
||||
@ -100,27 +107,6 @@ typedef enum {
|
||||
typedef void(intCallback_Type)(void);
|
||||
typedef void (*pFunc)(void);
|
||||
|
||||
/**
|
||||
* @brief Null Type definition
|
||||
*/
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#define BL602_MemCpy arch_memcpy
|
||||
#define BL602_MemSet arch_memset
|
||||
#define BL602_MemCmp arch_memcmp
|
||||
#define BL602_MemCpy4 arch_memcpy4
|
||||
#define BL602_MemCpy_Fast arch_memcpy_fast
|
||||
#define BL602_MemSet4 arch_memset4
|
||||
|
||||
#define BL702_MemCpy arch_memcpy
|
||||
#define BL702_MemSet arch_memset
|
||||
#define BL702_MemCmp arch_memcmp
|
||||
#define BL702_MemCpy4 arch_memcpy4
|
||||
#define BL702_MemCpy_Fast arch_memcpy_fast
|
||||
#define BL702_MemSet4 arch_memset4
|
||||
|
||||
#define ARCH_MemCpy arch_memcpy
|
||||
#define ARCH_MemSet arch_memset
|
||||
#define ARCH_MemCmp arch_memcmp
|
||||
@ -128,6 +114,13 @@ typedef void (*pFunc)(void);
|
||||
#define ARCH_MemCpy_Fast arch_memcpy_fast
|
||||
#define ARCH_MemSet4 arch_memset4
|
||||
|
||||
#ifdef DEBUG
|
||||
void check_failed(uint8_t *file, uint32_t line);
|
||||
#define CHECK_PARAM(expr) ((expr) ? (void)0 : check_failed((uint8_t *)__FILE__, __LINE__))
|
||||
#else
|
||||
#define CHECK_PARAM(expr) ((void)0)
|
||||
#endif /* DEBUG */
|
||||
|
||||
void *arch_memcpy(void *dst, const void *src, uint32_t n);
|
||||
void *arch_memset(void *s, uint8_t c, uint32_t n);
|
||||
int arch_memcmp(const void *s1, const void *s2, uint32_t n);
|
||||
|
@ -36,10 +36,7 @@
|
||||
#ifndef __PARTITION_H__
|
||||
#define __PARTITION_H__
|
||||
|
||||
#include "stdint.h"
|
||||
#include "string.h"
|
||||
#include "misc.h"
|
||||
//#include "bflb_bsp_driver_glue.h"
|
||||
|
||||
/** @addtogroup BFLB_Common_Driver
|
||||
* @{
|
||||
|
@ -24,7 +24,7 @@
|
||||
#ifndef __PID_H__
|
||||
#define __PID_H__
|
||||
|
||||
#include "stdio.h"
|
||||
#include "stdint.h"
|
||||
|
||||
typedef struct pid_alg {
|
||||
float set_val;
|
||||
|
@ -22,7 +22,6 @@
|
||||
*/
|
||||
|
||||
#include "timestamp.h"
|
||||
#include "misc.h"
|
||||
|
||||
#define FOUR_YEAR_DAY ((365 << 2) + 1) //The total number of days in a 4-year cycle
|
||||
#define TIMEZONE (8) //Beijing time Zone adjustment
|
||||
@ -127,7 +126,7 @@ void unixtime2bejingtime(uint32_t unixtime, rtc_time *beijing_time)
|
||||
beijing_time->day = remain_day;
|
||||
|
||||
|
||||
|
||||
|
||||
/*利用基姆拉尔森计算日期公式 w=(d+2*m+3*(m+1)/5+y+y/4-y/100+y/400)*/
|
||||
|
||||
beijing_time->week = beijing_time->day + 2*beijing_time->month + 3*(beijing_time->month+1)/5 + \
|
||||
|
@ -24,7 +24,8 @@
|
||||
#define _TIMESTAMP_
|
||||
|
||||
#include "stdint.h"
|
||||
#include "stdbool.h"
|
||||
#include "stddef.h"
|
||||
#include "stdbool.h"
|
||||
|
||||
typedef struct _rtc_time_t
|
||||
{
|
||||
@ -36,6 +37,7 @@ typedef struct _rtc_time_t
|
||||
uint8_t minute;
|
||||
uint8_t second;
|
||||
}rtc_time;
|
||||
|
||||
void unixtime2bejingtime(uint32_t unixtime,rtc_time* beijing_time);
|
||||
|
||||
#endif
|
||||
|
@ -99,7 +99,7 @@
|
||||
/* Automatically defrag. on free. Defrag. means joining the adjacent free cells. */
|
||||
#define LV_MEM_AUTO_DEFRAG 1
|
||||
#else /*LV_MEM_CUSTOM*/
|
||||
#define LV_MEM_CUSTOM_INCLUDE "stdio.h" /*Header for the dynamic memory function*/
|
||||
#define LV_MEM_CUSTOM_INCLUDE "stdlib.h" /*Header for the dynamic memory function*/
|
||||
#define LV_MEM_CUSTOM_ALLOC malloc /*Wrapper to malloc*/
|
||||
#define LV_MEM_CUSTOM_FREE free /*Wrapper to free*/
|
||||
#endif /*LV_MEM_CUSTOM*/
|
||||
|
@ -6,7 +6,7 @@
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
#include "bflb_platform.h"
|
||||
#include <rthw.h>
|
||||
#include "board.h"
|
||||
#include "hal_uart.h"
|
||||
|
@ -6,7 +6,7 @@
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
#include "bflb_platform.h"
|
||||
#include <rthw.h>
|
||||
#include "board.h"
|
||||
#include "hal_uart.h"
|
||||
|
@ -2,7 +2,6 @@
|
||||
#define _USB_DC_H
|
||||
|
||||
#include "stdint.h"
|
||||
#include "bflb_platform.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -5,7 +5,9 @@
|
||||
#include "string.h"
|
||||
#include "stdint.h"
|
||||
#include "stdio.h"
|
||||
#include "stdlib.h"
|
||||
#include "usb_slist.h"
|
||||
#include "bflb_platform.h"
|
||||
|
||||
#ifndef __packed
|
||||
#define __packed __attribute__((__packed__))
|
||||
|
@ -1,4 +1,6 @@
|
||||
#include "bflb_platform.h"
|
||||
#include <stddef.h>
|
||||
|
||||
static uint8_t *mallocBuf = NULL;
|
||||
static uint32_t malloced = 0;
|
||||
static uint32_t bufsize = 0;
|
||||
|
@ -24,6 +24,7 @@
|
||||
#define __HAL_CLOCK__H__
|
||||
|
||||
#include "hal_common.h"
|
||||
#include "bl602_config.h"
|
||||
|
||||
/*XTAL_TYPE*/
|
||||
#define XTAL_NONE 0
|
||||
|
@ -23,9 +23,7 @@
|
||||
#ifndef __HAL_COMMON__H__
|
||||
#define __HAL_COMMON__H__
|
||||
|
||||
#include "drv_device.h"
|
||||
#include "bl602_common.h"
|
||||
#include "bl602_config.h"
|
||||
|
||||
void cpu_global_irq_enable(void);
|
||||
void cpu_global_irq_disable(void);
|
||||
|
@ -24,6 +24,8 @@
|
||||
#define __HAL_DMA__H__
|
||||
|
||||
#include "hal_common.h"
|
||||
#include "drv_device.h"
|
||||
#include "bl602_config.h"
|
||||
|
||||
#define DMA_CHANNEL_GET_STATUS 0x10
|
||||
#define DMA_CHANNEL_START 0x11
|
||||
|
@ -37,6 +37,8 @@
|
||||
#define __HAL_GPIO__H__
|
||||
|
||||
#include "hal_common.h"
|
||||
#include "drv_device.h"
|
||||
#include "bl602_config.h"
|
||||
|
||||
typedef enum {
|
||||
GPIO_PIN_0 = 0,
|
||||
|
@ -24,6 +24,8 @@
|
||||
#define __HAL_SEC_HASH__H__
|
||||
|
||||
#include "hal_common.h"
|
||||
#include "drv_device.h"
|
||||
#include "bl602_config.h"
|
||||
|
||||
enum sec_hash_index_type {
|
||||
SEC_HASH0_INDEX,
|
||||
|
@ -37,6 +37,8 @@
|
||||
#define __HAL_UART__H__
|
||||
|
||||
#include "hal_common.h"
|
||||
#include "drv_device.h"
|
||||
#include "bl602_config.h"
|
||||
|
||||
#define UART_FIFO_LEN 32
|
||||
|
||||
|
@ -133,11 +133,13 @@ BL_Err_Type ATTR_TCM_SECTION flash_init(void)
|
||||
g_flash_cfg.ioMode = g_flash_cfg.ioMode & 0x0f;
|
||||
|
||||
ret = flash_config_init(&g_flash_cfg, (uint8_t *)&jedec_id);
|
||||
#if 0
|
||||
MSG("flash ID = %08x\r\n", jedec_id);
|
||||
bflb_platform_dump((uint8_t *)&g_flash_cfg, sizeof(g_flash_cfg));
|
||||
if (ret != SUCCESS) {
|
||||
MSG("flash config init fail!\r\n");
|
||||
}
|
||||
#endif
|
||||
g_flash_cfg.clkDelay = clkDelay;
|
||||
g_flash_cfg.clkInvert = clkInvert;
|
||||
|
||||
|
@ -449,7 +449,7 @@ static int sec_ecdsa_verify_point_mul(uint8_t id, const uint32_t *m)
|
||||
#endif
|
||||
} else if (pka_p1_eq_inf == 0 && pka_p2_eq_inf == 1) {
|
||||
//sum = X1
|
||||
MSG("sum = X1\r\n");
|
||||
//MSG("sum = X1\r\n");
|
||||
} else if (pka_p1_eq_inf == 0 && pka_p2_eq_inf == 0) {
|
||||
//sum = X1 + X2
|
||||
sec_ecdsa_point_add(id);
|
||||
@ -458,7 +458,7 @@ static int sec_ecdsa_verify_point_mul(uint8_t id, const uint32_t *m)
|
||||
sec_ecdsa_dump_temp_result();
|
||||
#endif
|
||||
} else {
|
||||
MSG("Error! infinite point + infinite point\r\n");
|
||||
//MSG("Error! infinite point + infinite point\r\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -41,6 +41,8 @@
|
||||
#include "bl602_glb.h"
|
||||
#include "uart_config.h"
|
||||
|
||||
#define UART_CLOCK (40000000)
|
||||
|
||||
#ifdef BSP_USING_UART0
|
||||
void UART0_IRQ(void);
|
||||
#endif
|
||||
@ -74,17 +76,18 @@ int uart_open(struct device *dev, uint16_t oflag)
|
||||
/* disable uart before config */
|
||||
UART_Disable(uart_device->id, UART_TXRX);
|
||||
|
||||
uint32_t uart_clk = peripheral_clock_get(PERIPHERAL_CLOCK_UART);
|
||||
//uint32_t uart_clk = peripheral_clock_get(PERIPHERAL_CLOCK_UART);
|
||||
|
||||
uart_cfg.baudRate = uart_device->baudrate;
|
||||
uart_cfg.dataBits = uart_device->databits;
|
||||
uart_cfg.stopBits = uart_device->stopbits;
|
||||
uart_cfg.parity = uart_device->parity;
|
||||
uart_cfg.uartClk = uart_clk;
|
||||
uart_cfg.uartClk = UART_CLOCK;
|
||||
uart_cfg.ctsFlowControl = UART_CTS_FLOWCONTROL_ENABLE;
|
||||
uart_cfg.rtsSoftwareControl = UART_RTS_FLOWCONTROL_ENABLE;
|
||||
uart_cfg.byteBitInverse = UART_MSB_FIRST_ENABLE;
|
||||
|
||||
GLB_Set_UART_CLK(ENABLE, HBN_UART_CLK_160M, 160000000 / UART_CLOCK - 1);
|
||||
/* uart init with default configuration */
|
||||
UART_Init(uart_device->id, &uart_cfg);
|
||||
|
||||
@ -170,8 +173,10 @@ int uart_control(struct device *dev, int cmd, void *args)
|
||||
}
|
||||
|
||||
if (uart_device->id == UART0_ID) {
|
||||
Interrupt_Handler_Register(UART0_IRQn, UART0_IRQ);
|
||||
CPU_Interrupt_Enable(UART0_IRQn);
|
||||
} else if (uart_device->id == UART1_ID) {
|
||||
Interrupt_Handler_Register(UART1_IRQn, UART1_IRQ);
|
||||
CPU_Interrupt_Enable(UART1_IRQn);
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
#include "bl602.h"
|
||||
#include "bl602_common.h"
|
||||
#include "bflb_platform.h"
|
||||
|
||||
pFunc __Interrupt_Handlers[IRQn_LAST] = { 0 };
|
||||
@ -305,6 +305,10 @@ void Interrupt_Handler_Register(IRQn_Type irq, pFunc interruptFun)
|
||||
}
|
||||
}
|
||||
|
||||
void System_NVIC_SetPriority(IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority)
|
||||
{
|
||||
}
|
||||
|
||||
void clic_enable_interrupt(uint32_t source)
|
||||
{
|
||||
*(volatile uint8_t *)(CLIC_HART0_ADDR + CLIC_INTIE + source) = 1;
|
||||
|
@ -80,16 +80,9 @@ void SystemInit(void)
|
||||
|
||||
/*identify flash config automaticly*/
|
||||
extern BL_Err_Type flash_init(void);
|
||||
extern void bflb_platform_print_set(uint8_t disable);
|
||||
void System_Post_Init(void)
|
||||
{
|
||||
PDS_Trim_RC32M();
|
||||
HBN_Trim_RC32K();
|
||||
bflb_platform_print_set(1);
|
||||
flash_init();
|
||||
bflb_platform_print_set(0);
|
||||
}
|
||||
|
||||
void System_NVIC_SetPriority(IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority)
|
||||
{
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
#define __BL602_COMMON_H__
|
||||
|
||||
#include "bl602.h"
|
||||
#include "bflb_platform.h"
|
||||
#include "misc.h"
|
||||
|
||||
#ifndef __NOP
|
||||
#define __NOP() __ASM volatile("nop") /* This implementation generates debug information */
|
||||
@ -57,6 +57,32 @@ __ALWAYS_STATIC_INLINE void __disable_irq(void)
|
||||
__ASM volatile("csrc mstatus, 8");
|
||||
}
|
||||
|
||||
/** @defgroup COMMON_Public_Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup DRIVER_INT_PERIPH
|
||||
* @{
|
||||
*/
|
||||
#define IS_INT_PERIPH(INT_PERIPH) ((INT_PERIPH) < IRQn_LAST)
|
||||
|
||||
/*@} end of group DRIVER_INT_PERIPH */
|
||||
|
||||
/** @defgroup DRIVER_INT_MASK
|
||||
* @{
|
||||
*/
|
||||
#define IS_BL_MASK_TYPE(type) (((type) == MASK) || ((type) == UNMASK))
|
||||
|
||||
/*@} end of group COMMON_Public_Constants */
|
||||
|
||||
/*@} end of group DRIVER_Public_Macro */
|
||||
#define BL602_MemCpy arch_memcpy
|
||||
#define BL602_MemSet arch_memset
|
||||
#define BL602_MemCmp arch_memcmp
|
||||
#define BL602_MemCpy4 arch_memcpy4
|
||||
#define BL602_MemCpy_Fast arch_memcpy_fast
|
||||
#define BL602_MemSet4 arch_memset4
|
||||
|
||||
#define arch_delay_us BL602_Delay_US
|
||||
#define arch_delay_ms BL602_Delay_MS
|
||||
|
||||
|
@ -1,49 +0,0 @@
|
||||
#ifndef __BL602_IT_H__
|
||||
#define __BL602_IT_H__
|
||||
|
||||
#include "bl602.h"
|
||||
#include "bl_common.h"
|
||||
|
||||
/** @addtogroup BL606_Peripheral_Driver
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup COMMON
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup COMMON_Public_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*@} end of group COMMON_Public_Types */
|
||||
|
||||
/** @defgroup COMMON_Public_Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup DRIVER_INT_PERIPH
|
||||
* @{
|
||||
*/
|
||||
#define IS_INT_PERIPH(INT_PERIPH) ((INT_PERIPH) < IRQn_LAST)
|
||||
|
||||
/*@} end of group DRIVER_INT_PERIPH */
|
||||
|
||||
/** @defgroup DRIVER_INT_MASK
|
||||
* @{
|
||||
*/
|
||||
#define IS_BL_MASK_TYPE(type) (((type) == MASK) || ((type) == UNMASK))
|
||||
|
||||
/*@} end of group COMMON_Public_Constants */
|
||||
|
||||
/*@} end of group DRIVER_Public_Macro */
|
||||
|
||||
/** @defgroup DRIVER_Public_FunctionDeclaration
|
||||
* @brief DRIVER functions declaration
|
||||
* @{
|
||||
*/
|
||||
void Interrupt_Handler_Register(IRQn_Type irq, pFunc interruptFun);
|
||||
|
||||
/*@} end of group DRIVER_COMMON */
|
||||
|
||||
#endif /* __BL602_COMMON_H__ */
|
@ -665,6 +665,11 @@ static const ATTR_TCM_CONST_SECTION Flash_Info_t flashInfos[]={
|
||||
//.name="ZD_25Q16B",
|
||||
.cfg=&flashCfg_ZD_25Q16B,
|
||||
},
|
||||
{
|
||||
.jedecID=0x1460CD,
|
||||
//.name="TH_25Q80HB",
|
||||
.cfg=&flashCfg_FM_25Q08,
|
||||
},
|
||||
};
|
||||
|
||||
/*@} end of group SF_CFG_EXT_Private_Variables */
|
||||
|
@ -284,7 +284,7 @@ BL_Err_Type UART_Init(UART_ID_Type uartId, UART_CFG_Type *uartCfg)
|
||||
|
||||
BL_WR_REG(UARTx, UART_DATA_CONFIG, tmpValTxCfg);
|
||||
|
||||
#if 1 //#ifndef BFLB_USE_HAL_DRIVER
|
||||
#ifndef BFLB_USE_HAL_DRIVER
|
||||
Interrupt_Handler_Register(UART0_IRQn, UART0_IRQHandler);
|
||||
Interrupt_Handler_Register(UART1_IRQn, UART1_IRQHandler);
|
||||
#endif
|
||||
|
@ -6,6 +6,7 @@ extern "C"{
|
||||
#endif
|
||||
|
||||
#include "hal_common.h"
|
||||
#include "drv_device.h"
|
||||
|
||||
enum acomp_channel_type {
|
||||
ACOMP_CHANNEL_ADC_CHANNEL0, /*!< Analog compare channel,ADC input channel 0 */
|
||||
|
@ -28,6 +28,8 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#include "hal_common.h"
|
||||
#include "drv_device.h"
|
||||
#include "bl702_config.h"
|
||||
|
||||
#define DEVICE_CTRL_ADC_CHANNEL_START 0x10
|
||||
#define DEVICE_CTRL_ADC_CHANNEL_STOP 0x11
|
||||
|
@ -29,6 +29,8 @@ extern "C"{
|
||||
#endif
|
||||
|
||||
#include "hal_common.h"
|
||||
#include "drv_device.h"
|
||||
#include "bl702_config.h"
|
||||
#include "bl702_cam.h"
|
||||
|
||||
#define DEVICE_OFLAG_INT 0x01
|
||||
|
@ -28,6 +28,7 @@ extern "C"{
|
||||
#endif
|
||||
|
||||
#include "hal_common.h"
|
||||
#include "bl702_config.h"
|
||||
|
||||
/*XTAL_TYPE*/
|
||||
#define XTAL_NONE 0
|
||||
|
@ -27,9 +27,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "drv_device.h"
|
||||
#include "bl702_common.h"
|
||||
#include "bl702_config.h"
|
||||
|
||||
void cpu_global_irq_enable(void);
|
||||
void cpu_global_irq_disable(void);
|
||||
|
@ -28,6 +28,8 @@ extern "C"{
|
||||
#endif
|
||||
|
||||
#include "hal_common.h"
|
||||
#include "drv_device.h"
|
||||
#include "bl702_config.h"
|
||||
|
||||
enum dac_index_type {
|
||||
#ifdef BSP_USING_DAC0
|
||||
|
@ -28,6 +28,8 @@ extern "C"{
|
||||
#endif
|
||||
|
||||
#include "hal_common.h"
|
||||
#include "drv_device.h"
|
||||
#include "bl702_config.h"
|
||||
|
||||
#define DMA_CHANNEL_GET_STATUS 0x10
|
||||
#define DMA_CHANNEL_START 0x11
|
||||
|
@ -29,6 +29,8 @@ extern "C"{
|
||||
#endif
|
||||
|
||||
#include "hal_common.h"
|
||||
#include "drv_device.h"
|
||||
#include "bl702_config.h"
|
||||
#include "bl702_emac.h"
|
||||
|
||||
typedef struct emac_device {
|
||||
|
@ -28,6 +28,8 @@ extern "C"{
|
||||
#endif
|
||||
|
||||
#include "hal_common.h"
|
||||
#include "drv_device.h"
|
||||
#include "bl702_config.h"
|
||||
|
||||
enum gpio_pin_type {
|
||||
GPIO_PIN_0 = 0,
|
||||
|
@ -28,6 +28,8 @@ extern "C"{
|
||||
#endif
|
||||
|
||||
#include "hal_common.h"
|
||||
#include "drv_device.h"
|
||||
#include "bl702_config.h"
|
||||
|
||||
enum i2c_index_type {
|
||||
#ifdef BSP_USING_I2C0
|
||||
|
@ -28,10 +28,14 @@ extern "C"{
|
||||
#endif
|
||||
|
||||
#include "hal_common.h"
|
||||
#include "drv_device.h"
|
||||
#include "bl702_config.h"
|
||||
|
||||
#define DEVICE_CTRL_I2S_GET_TX_FIFO 0x10
|
||||
#define DEVICE_CTRL_I2S_GET_RX_FIFO 0x11
|
||||
|
||||
#define DEVICE_CTRL_I2S_SET_SAMPL_FREQ 0x12
|
||||
|
||||
enum i2s_index_type {
|
||||
#ifdef BSP_USING_I2S0
|
||||
I2S0_INDEX,
|
||||
|
@ -22,11 +22,14 @@
|
||||
*/
|
||||
#ifndef __HAL_KEYSCAN__H__
|
||||
#define __HAL_KEYSCAN__H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
#include "hal_common.h"
|
||||
#include "drv_device.h"
|
||||
#include "bl702_config.h"
|
||||
|
||||
#define DEVICE_CTRL_KEYSCAN_GET_KEYCODE 0x10
|
||||
|
||||
|
@ -22,11 +22,14 @@
|
||||
*/
|
||||
#ifndef __HAL_MJPEG__H__
|
||||
#define __HAL_MJPEG__H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
#include "hal_common.h"
|
||||
#include "drv_device.h"
|
||||
#include "bl702_config.h"
|
||||
|
||||
#define MJPEG_PACKET_ADD_NONE 0
|
||||
#define MJPEG_PACKET_ADD_DEFAULT 1 << 0
|
||||
|
@ -22,10 +22,14 @@
|
||||
*/
|
||||
#ifndef __HAL_PWM__H__
|
||||
#define __HAL_PWM__H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
#include "hal_common.h"
|
||||
#include "drv_device.h"
|
||||
#include "bl702_config.h"
|
||||
|
||||
#define DEVICE_CTRL_PWM_FREQUENCE_CONFIG 0x10
|
||||
#define DEVICE_CTRL_PWM_DUTYCYCLE_CONFIG 0x11
|
||||
|
@ -23,10 +23,14 @@
|
||||
|
||||
#ifndef __HAL_QDEC__H__
|
||||
#define __HAL_QDEC__H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
#include "hal_common.h"
|
||||
#include "drv_device.h"
|
||||
#include "bl702_config.h"
|
||||
|
||||
#define DEVICE_CTRL_GET_SAMPLE_VAL (0x10)
|
||||
#define DEVICE_CTRL_GET_SAMPLE_DIR (0x11)
|
||||
|
@ -22,6 +22,7 @@
|
||||
*/
|
||||
#ifndef __HAL_RTC__H__
|
||||
#define __HAL_RTC__H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
@ -31,6 +32,7 @@ extern "C"{
|
||||
void rtc_init(uint64_t sleep_time);
|
||||
void rtc_set_timestamp(uint64_t time_stamp);
|
||||
uint64_t rtc_get_timestamp(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -22,6 +22,7 @@
|
||||
*/
|
||||
#ifndef __HAL_SEC_AES__H__
|
||||
#define __HAL_SEC_AES__H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
@ -22,6 +22,7 @@
|
||||
*/
|
||||
#ifndef __HAL_SEC_DSA__H__
|
||||
#define __HAL_SEC_DSA__H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
@ -22,6 +22,7 @@
|
||||
*/
|
||||
#ifndef __HAL_SEC_ECDSA__H__
|
||||
#define __HAL_SEC_ECDSA__H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
@ -22,11 +22,14 @@
|
||||
*/
|
||||
#ifndef __HAL_SEC_HASH__H__
|
||||
#define __HAL_SEC_HASH__H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
#include "hal_common.h"
|
||||
#include "drv_device.h"
|
||||
#include "bl702_config.h"
|
||||
|
||||
enum sec_hash_index_type {
|
||||
SEC_HASH0_INDEX,
|
||||
|
@ -22,11 +22,14 @@
|
||||
*/
|
||||
#ifndef __HAL_SPI__H__
|
||||
#define __HAL_SPI__H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
#include "hal_common.h"
|
||||
#include "drv_device.h"
|
||||
#include "bl702_config.h"
|
||||
|
||||
#define DEVICE_CTRL_SPI_CONFIG_CLOCK 0x10
|
||||
|
||||
|
@ -26,7 +26,10 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
#include "hal_common.h"
|
||||
#include "drv_device.h"
|
||||
#include "bl702_config.h"
|
||||
|
||||
enum timer_index_type {
|
||||
#ifdef BSP_USING_TIMER0
|
||||
|
@ -22,11 +22,14 @@
|
||||
*/
|
||||
#ifndef __HAL_UART__H__
|
||||
#define __HAL_UART__H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
#include "hal_common.h"
|
||||
#include "drv_device.h"
|
||||
#include "bl702_config.h"
|
||||
|
||||
#define UART_FIFO_LEN 128
|
||||
|
||||
|
@ -22,12 +22,15 @@
|
||||
*/
|
||||
#ifndef __HAL_USB__H__
|
||||
#define __HAL_USB__H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
#include "hal_common.h"
|
||||
#include "ring_buffer.h"
|
||||
#include "drv_device.h"
|
||||
#include "bl702_config.h"
|
||||
|
||||
#define DEVICE_CTRL_USB_DC_SET_ACK 0X10
|
||||
#define DEVICE_CTRL_USB_DC_ENUM_ON 0X11
|
||||
@ -125,6 +128,16 @@ enum usb_dc_event_type {
|
||||
/** USB connection resumed by the HOST */
|
||||
USB_DC_EVENT_RESUME,
|
||||
|
||||
/** USB interface selected */
|
||||
USB_DC_EVENT_SET_INTERFACE,
|
||||
/** USB interface selected */
|
||||
USB_DC_EVENT_SET_REMOTE_WAKEUP,
|
||||
/** USB interface selected */
|
||||
USB_DC_EVENT_CLEAR_REMOTE_WAKEUP,
|
||||
/** Set Feature ENDPOINT_HALT received */
|
||||
USB_DC_EVENT_SET_HALT,
|
||||
/** Clear Feature ENDPOINT_HALT received */
|
||||
USB_DC_EVENT_CLEAR_HALT,
|
||||
/** setup packet received */
|
||||
USB_DC_EVENT_SETUP_NOTIFY,
|
||||
/** ep0 in packet received */
|
||||
|
@ -22,10 +22,14 @@
|
||||
*/
|
||||
#ifndef __HAL_WDT__H__
|
||||
#define __HAL_WDT__H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
#include "hal_common.h"
|
||||
#include "drv_device.h"
|
||||
#include "bl702_config.h"
|
||||
|
||||
#define DEVICE_CTRL_GET_WDT_COUNTER (0x10)
|
||||
#define DEVICE_CTRL_RST_WDT_COUNTER (0x11)
|
||||
|
@ -62,7 +62,7 @@ void hal_enter_usb_iap(void)
|
||||
{
|
||||
BL_WR_WORD(HBN_BASE + HBN_RSV0_OFFSET, 0x00425355); //"\0BSU"
|
||||
|
||||
bflb_platform_delay_ms(1000);
|
||||
arch_delay_ms(1000);
|
||||
RomDriver_GLB_SW_System_Reset();
|
||||
}
|
||||
|
||||
@ -75,7 +75,8 @@ void ATTR_TCM_SECTION hal_jump2app(uint32_t flash_offset)
|
||||
L1C_Cache_Flush_Ext();
|
||||
app_main();
|
||||
} else {
|
||||
MSG("Illegal app flash offset:%d\r\n", flash_offset);
|
||||
while(1)
|
||||
{}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,10 @@
|
||||
#include "bl702_glb.h"
|
||||
#include "hal_emac.h"
|
||||
|
||||
#ifndef MSG
|
||||
#define MSG(a,...)
|
||||
#endif
|
||||
|
||||
#define EMAC_USE_INSIDE_CLOCK (0)
|
||||
#define TAG "EMAC_BD: "
|
||||
|
||||
|
@ -132,11 +132,13 @@ BL_Err_Type ATTR_TCM_SECTION flash_init(void)
|
||||
g_flash_cfg.ioMode = g_flash_cfg.ioMode & 0x0f;
|
||||
|
||||
ret = flash_config_init(&g_flash_cfg, (uint8_t *)&jedec_id);
|
||||
#if 0
|
||||
MSG("flash ID = %08x\r\n", jedec_id);
|
||||
bflb_platform_dump((uint8_t *)&g_flash_cfg, sizeof(g_flash_cfg));
|
||||
if (ret != SUCCESS) {
|
||||
MSG("flash config init fail!\r\n");
|
||||
}
|
||||
#endif
|
||||
g_flash_cfg.clkDelay = clkDelay;
|
||||
g_flash_cfg.clkInvert = clkInvert;
|
||||
|
||||
|
@ -225,7 +225,7 @@ static void GPIO_IRQ(void)
|
||||
} while ((SET == GLB_Get_GPIO_IntStatus(int_cfg->pin)) && timeOut);
|
||||
|
||||
if (!timeOut) {
|
||||
MSG("WARNING: Clear GPIO interrupt status fail.\r\n");
|
||||
//MSG("WARNING: Clear GPIO interrupt status fail.\r\n");
|
||||
}
|
||||
|
||||
GLB_GPIO_IntClear(int_cfg->pin, RESET);
|
||||
|
@ -21,6 +21,7 @@
|
||||
*
|
||||
*/
|
||||
#include "hal_i2s.h"
|
||||
#include "hal_clock.h"
|
||||
#include "hal_dma.h"
|
||||
#include "bl702_i2s.h"
|
||||
#include "bl702_glb.h"
|
||||
@ -38,40 +39,7 @@ int i2s_open(struct device *dev, uint16_t oflag)
|
||||
I2S_CFG_Type i2sCfg = { 0 };
|
||||
I2S_FifoCfg_Type fifoCfg = { 0 };
|
||||
|
||||
GLB_Set_Chip_Out_0_CLK_Sel(GLB_CHIP_CLK_OUT_I2S_REF_CLK);
|
||||
GLB_Set_I2S_CLK(ENABLE, GLB_I2S_OUT_REF_CLK_NONE);
|
||||
|
||||
/*Finding the right frequency*/
|
||||
if (12288000 % (i2s_device->sampl_freq_hz) == 0) {
|
||||
i2sCfg.audioFreqHz = 12288000;
|
||||
PDS_Set_Audio_PLL_Freq(AUDIO_PLL_12288000_HZ);
|
||||
} else if (11289600 % (i2s_device->sampl_freq_hz) == 0) {
|
||||
i2sCfg.audioFreqHz = 11289600;
|
||||
PDS_Set_Audio_PLL_Freq(AUDIO_PLL_11289600_HZ);
|
||||
} else if (5644800 % (i2s_device->sampl_freq_hz) == 0) {
|
||||
i2sCfg.audioFreqHz = 5644800;
|
||||
PDS_Set_Audio_PLL_Freq(AUDIO_PLL_5644800_HZ);
|
||||
} else {
|
||||
switch (I2S_ADUIO_PLL_DEFAULT) {
|
||||
case AUDIO_PLL_12288000_HZ:
|
||||
i2sCfg.audioFreqHz = 12288000;
|
||||
break;
|
||||
|
||||
case AUDIO_PLL_11289600_HZ:
|
||||
i2sCfg.audioFreqHz = 11289600;
|
||||
break;
|
||||
|
||||
case AUDIO_PLL_5644800_HZ:
|
||||
i2sCfg.audioFreqHz = 5644800;
|
||||
break;
|
||||
|
||||
default:
|
||||
return ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
PDS_Set_Audio_PLL_Freq(I2S_ADUIO_PLL_DEFAULT);
|
||||
}
|
||||
i2sCfg.audioFreqHz = system_clock_get(SYSTEM_CLOCK_AUPLL);
|
||||
|
||||
i2sCfg.sampleFreqHz = i2s_device->sampl_freq_hz;
|
||||
|
||||
@ -242,6 +210,8 @@ int i2s_control(struct device *dev, int cmd, void *args)
|
||||
{
|
||||
i2s_device_t *i2s_device = (i2s_device_t *)dev;
|
||||
|
||||
I2S_CFG_Type i2sCfg;
|
||||
|
||||
switch (cmd) {
|
||||
case DEVICE_CTRL_SET_INT:
|
||||
for (uint16_t i = 0, j = 1; i < 8; i++, j <<= 1) {
|
||||
@ -291,6 +261,32 @@ int i2s_control(struct device *dev, int cmd, void *args)
|
||||
case DEVICE_CTRL_I2S_GET_RX_FIFO:
|
||||
return I2S_GetRxFIFO_AvlCnt();
|
||||
|
||||
case DEVICE_CTRL_I2S_SET_SAMPL_FREQ:
|
||||
switch (i2s_device->frame_size) {
|
||||
case I2S_FRAME_LEN_8:
|
||||
i2sCfg.frameSize = I2S_SIZE_FRAME_8;
|
||||
break;
|
||||
|
||||
case I2S_FRAME_LEN_16:
|
||||
i2sCfg.frameSize = I2S_SIZE_FRAME_16;
|
||||
break;
|
||||
|
||||
case I2S_FRAME_LEN_24:
|
||||
i2sCfg.frameSize = I2S_SIZE_FRAME_24;
|
||||
break;
|
||||
|
||||
case I2S_FRAME_LEN_32:
|
||||
i2sCfg.frameSize = I2S_SIZE_FRAME_32;
|
||||
break;
|
||||
default:
|
||||
return ERROR;
|
||||
break;
|
||||
}
|
||||
i2sCfg.audioFreqHz = system_clock_get(SYSTEM_CLOCK_AUPLL);
|
||||
i2sCfg.sampleFreqHz = (uint32_t)args;
|
||||
I2S_SetBclkPeriod(&i2sCfg);
|
||||
break;
|
||||
|
||||
default:
|
||||
return ERROR;
|
||||
break;
|
||||
|
@ -449,7 +449,7 @@ static int sec_ecdsa_verify_point_mul(uint8_t id, const uint32_t *m)
|
||||
#endif
|
||||
} else if (pka_p1_eq_inf == 0 && pka_p2_eq_inf == 1) {
|
||||
//sum = X1
|
||||
MSG("sum = X1\r\n");
|
||||
//MSG("sum = X1\r\n");
|
||||
} else if (pka_p1_eq_inf == 0 && pka_p2_eq_inf == 0) {
|
||||
//sum = X1 + X2
|
||||
sec_ecdsa_point_add(id);
|
||||
@ -458,7 +458,7 @@ static int sec_ecdsa_verify_point_mul(uint8_t id, const uint32_t *m)
|
||||
sec_ecdsa_dump_temp_result();
|
||||
#endif
|
||||
} else {
|
||||
MSG("Error! infinite point + infinite point\r\n");
|
||||
//MSG("Error! infinite point + infinite point\r\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -124,7 +124,6 @@ int wdt_write(struct device *dev, uint32_t pos, const void *buffer, uint32_t siz
|
||||
uint16_t wdt_timeout = (uint16_t)(uint32_t)buffer;
|
||||
|
||||
WDT_Disable();
|
||||
MSG("wdt timeout %d \r\n", wdt_timeout);
|
||||
WDT_SetCompValue(wdt_timeout);
|
||||
WDT_Enable();
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
*
|
||||
*/
|
||||
#include "bl702_common.h"
|
||||
#include "bl702.h"
|
||||
#include "bflb_platform.h"
|
||||
|
||||
pFunc __Interrupt_Handlers[IRQn_LAST] = { 0 };
|
||||
|
||||
|
@ -135,12 +135,9 @@ void SystemInit(void)
|
||||
}
|
||||
/*identify flash config automaticly*/
|
||||
extern BL_Err_Type flash_init(void);
|
||||
extern void bflb_platform_print_set(uint8_t disable);
|
||||
void System_Post_Init(void)
|
||||
{
|
||||
PDS_Trim_RC32M();
|
||||
HBN_Trim_RC32K();
|
||||
bflb_platform_print_set(1);
|
||||
flash_init();
|
||||
bflb_platform_print_set(0);
|
||||
}
|
@ -1,107 +1,112 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file bl702_aon.h
|
||||
* @version V1.0
|
||||
* @date
|
||||
* @brief This file is the standard driver header file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2020 Bouffalo Lab</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. 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.
|
||||
* 3. Neither the name of Bouffalo Lab 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 THE COPYRIGHT HOLDER OR 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 __BL702_AON_H__
|
||||
#define __BL702_AON_H__
|
||||
|
||||
#include "aon_reg.h"
|
||||
#include "glb_reg.h"
|
||||
#include "hbn_reg.h"
|
||||
#include "pds_reg.h"
|
||||
#include "bl702_ef_ctrl.h"
|
||||
#include "bl702_common.h"
|
||||
|
||||
/** @addtogroup BL702_Peripheral_Driver
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup AON
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup AON_Public_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*@} end of group AON_Public_Types */
|
||||
|
||||
/** @defgroup AON_Public_Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*@} end of group AON_Public_Constants */
|
||||
|
||||
/** @defgroup AON_Public_Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*@} end of group AON_Public_Macros */
|
||||
|
||||
/** @defgroup AON_Public_Functions
|
||||
* @{
|
||||
*/
|
||||
/*----------*/
|
||||
BL_Err_Type AON_Power_On_MBG(void);
|
||||
BL_Err_Type AON_Power_Off_MBG(void);
|
||||
/*----------*/
|
||||
BL_Err_Type AON_Power_On_XTAL(void);
|
||||
BL_Err_Type AON_Set_Xtal_CapCode(uint8_t capIn, uint8_t capOut);
|
||||
uint8_t AON_Get_Xtal_CapCode(void);
|
||||
BL_Err_Type AON_Power_Off_XTAL(void);
|
||||
/*----------*/
|
||||
BL_Err_Type AON_Power_On_BG(void);
|
||||
BL_Err_Type AON_Power_Off_BG(void);
|
||||
/*----------*/
|
||||
BL_Err_Type AON_Power_On_LDO11_SOC(void);
|
||||
BL_Err_Type AON_Power_Off_LDO11_SOC(void);
|
||||
/*----------*/
|
||||
BL_Err_Type AON_Power_On_LDO15_RF(void);
|
||||
BL_Err_Type AON_Power_Off_LDO15_RF(void);
|
||||
/*----------*/
|
||||
BL_Err_Type AON_Power_On_SFReg(void);
|
||||
BL_Err_Type AON_Power_Off_SFReg(void);
|
||||
/*----------*/
|
||||
BL_Err_Type AON_LowPower_Enter_PDS0(void);
|
||||
BL_Err_Type AON_LowPower_Exit_PDS0(void);
|
||||
/*----------*/
|
||||
BL_Err_Type AON_Set_LDO11_SOC_Sstart_Delay(uint8_t delay);
|
||||
|
||||
/*@} end of group AON_Public_Functions */
|
||||
|
||||
/*@} end of group AON */
|
||||
|
||||
/*@} end of group BL702_Peripheral_Driver */
|
||||
|
||||
#endif /* __BL702_AON_H__ */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file bl702_aon.h
|
||||
* @version V1.0
|
||||
* @date
|
||||
* @brief This file is the standard driver header file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© COPYRIGHT(c) 2020 Bouffalo Lab</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. 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.
|
||||
* 3. Neither the name of Bouffalo Lab 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 THE COPYRIGHT HOLDER OR 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 __BL702_AON_H__
|
||||
#define __BL702_AON_H__
|
||||
|
||||
#include "aon_reg.h"
|
||||
#include "glb_reg.h"
|
||||
#include "hbn_reg.h"
|
||||
#include "pds_reg.h"
|
||||
#include "bl702_ef_ctrl.h"
|
||||
#include "bl702_common.h"
|
||||
|
||||
/** @addtogroup BL702_Peripheral_Driver
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup AON
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup AON_Public_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*@} end of group AON_Public_Types */
|
||||
|
||||
/** @defgroup AON_Public_Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*@} end of group AON_Public_Constants */
|
||||
|
||||
/** @defgroup AON_Public_Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*@} end of group AON_Public_Macros */
|
||||
|
||||
/** @defgroup AON_Public_Functions
|
||||
* @{
|
||||
*/
|
||||
/*----------*/
|
||||
BL_Err_Type AON_Power_On_MBG(void);
|
||||
BL_Err_Type AON_Power_Off_MBG(void);
|
||||
/*----------*/
|
||||
BL_Err_Type AON_Power_On_XTAL(void);
|
||||
BL_Err_Type AON_Set_Xtal_CapCode(uint8_t capIn, uint8_t capOut);
|
||||
uint8_t AON_Get_Xtal_CapCode(void);
|
||||
BL_Err_Type AON_Set_Xtal_CapCode_Extra(uint8_t extra);
|
||||
BL_Err_Type AON_Power_Off_XTAL(void);
|
||||
/*----------*/
|
||||
BL_Err_Type AON_Power_On_BG(void);
|
||||
BL_Err_Type AON_Power_Off_BG(void);
|
||||
/*----------*/
|
||||
BL_Err_Type AON_Power_On_LDO11_SOC(void);
|
||||
BL_Err_Type AON_Power_Off_LDO11_SOC(void);
|
||||
/*----------*/
|
||||
BL_Err_Type AON_Power_On_LDO15_RF(void);
|
||||
BL_Err_Type AON_Power_Off_LDO15_RF(void);
|
||||
/*----------*/
|
||||
BL_Err_Type AON_Power_On_SFReg(void);
|
||||
BL_Err_Type AON_Power_Off_SFReg(void);
|
||||
/*----------*/
|
||||
BL_Err_Type AON_LowPower_Enter_PDS0(void);
|
||||
BL_Err_Type AON_LowPower_Exit_PDS0(void);
|
||||
/*----------*/
|
||||
BL_Err_Type AON_Set_LDO11_SOC_Sstart_Delay(uint8_t delay);
|
||||
/*----------*/
|
||||
BL_Err_Type AON_Set_DCDC18_Top_0(uint8_t voutSel, uint8_t vpfm);
|
||||
BL_Err_Type AON_Set_Xtal_Cfg(uint8_t gmBoost, uint8_t ampCtrl, uint8_t fastStartup);
|
||||
/*----------*/
|
||||
|
||||
/*@} end of group AON_Public_Functions */
|
||||
|
||||
/*@} end of group AON */
|
||||
|
||||
/*@} end of group BL702_Peripheral_Driver */
|
||||
|
||||
#endif /* __BL702_AON_H__ */
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define __BL702_COMMON_H__
|
||||
|
||||
#include "bl702.h"
|
||||
#include "bflb_platform.h"
|
||||
#include "misc.h"
|
||||
|
||||
#ifndef __NOP
|
||||
#define __NOP() __ASM volatile("nop") /* This implementation generates debug information */
|
||||
@ -57,6 +57,32 @@ __ALWAYS_STATIC_INLINE void __disable_irq(void)
|
||||
__ASM volatile("csrc mstatus, 8");
|
||||
}
|
||||
|
||||
/** @defgroup COMMON_Public_Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup DRIVER_INT_PERIPH
|
||||
* @{
|
||||
*/
|
||||
#define IS_INT_PERIPH(INT_PERIPH) ((INT_PERIPH) < IRQn_LAST)
|
||||
|
||||
/*@} end of group DRIVER_INT_PERIPH */
|
||||
|
||||
/** @defgroup DRIVER_INT_MASK
|
||||
* @{
|
||||
*/
|
||||
#define IS_BL_MASK_TYPE(type) (((type) == MASK) || ((type) == UNMASK))
|
||||
|
||||
/*@} end of group COMMON_Public_Constants */
|
||||
|
||||
/*@} end of group DRIVER_Public_Macro */
|
||||
#define BL702_MemCpy arch_memcpy
|
||||
#define BL702_MemSet arch_memset
|
||||
#define BL702_MemCmp arch_memcmp
|
||||
#define BL702_MemCpy4 arch_memcpy4
|
||||
#define BL702_MemCpy_Fast arch_memcpy_fast
|
||||
#define BL702_MemSet4 arch_memset4
|
||||
|
||||
#define arch_delay_us BL702_Delay_US
|
||||
#define arch_delay_ms BL702_Delay_MS
|
||||
|
||||
|
@ -1,49 +0,0 @@
|
||||
#ifndef __BL702_IT_H__
|
||||
#define __BL702_IT_H__
|
||||
|
||||
#include "bl702.h"
|
||||
#include "bl_common.h"
|
||||
|
||||
/** @addtogroup BL606_Peripheral_Driver
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup COMMON
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup COMMON_Public_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*@} end of group COMMON_Public_Types */
|
||||
|
||||
/** @defgroup COMMON_Public_Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup DRIVER_INT_PERIPH
|
||||
* @{
|
||||
*/
|
||||
#define IS_INT_PERIPH(INT_PERIPH) ((INT_PERIPH) < IRQn_LAST)
|
||||
|
||||
/*@} end of group DRIVER_INT_PERIPH */
|
||||
|
||||
/** @defgroup DRIVER_INT_MASK
|
||||
* @{
|
||||
*/
|
||||
#define IS_BL_MASK_TYPE(type) (((type) == MASK) || ((type) == UNMASK))
|
||||
|
||||
/*@} end of group COMMON_Public_Constants */
|
||||
|
||||
/*@} end of group DRIVER_Public_Macro */
|
||||
|
||||
/** @defgroup DRIVER_Public_FunctionDeclaration
|
||||
* @brief DRIVER functions declaration
|
||||
* @{
|
||||
*/
|
||||
void Interrupt_Handler_Register(IRQn_Type irq, pFunc interruptFun);
|
||||
|
||||
/*@} end of group DRIVER_COMMON */
|
||||
|
||||
#endif /* __BL602_COMMON_H__ */
|
File diff suppressed because it is too large
Load Diff
@ -20,6 +20,7 @@
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
#include "bflb_platform.h"
|
||||
#include "hal_pm.h"
|
||||
#include "hal_acomp.h"
|
||||
#include "hal_uart.h"
|
||||
|
@ -20,6 +20,7 @@
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
#include "bflb_platform.h"
|
||||
#include "hal_adc.h"
|
||||
#include "hal_gpio.h"
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
#include "bflb_platform.h"
|
||||
#include "hal_adc.h"
|
||||
#include "hal_gpio.h"
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
#include "bflb_platform.h"
|
||||
#include "hal_adc.h"
|
||||
#include "hal_gpio.h"
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
#include "bflb_platform.h"
|
||||
#include "hal_adc.h"
|
||||
#include "hal_gpio.h"
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
#include "bflb_platform.h"
|
||||
#include "hal_adc.h"
|
||||
#include "hal_gpio.h"
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
#include "bflb_platform.h"
|
||||
#include "hal_adc.h"
|
||||
#include "hal_gpio.h"
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
#include "bflb_platform.h"
|
||||
#include "hal_adc.h"
|
||||
#include "hal_gpio.h"
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "bflb_platform.h"
|
||||
#include "hal_adc.h"
|
||||
#include "hal_gpio.h"
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
#include "bflb_platform.h"
|
||||
#include "hal_adc.h"
|
||||
#include "hal_gpio.h"
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "bflb_platform.h"
|
||||
#include "hal_i2s.h"
|
||||
#include "hal_dma.h"
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "bflb_platform.h"
|
||||
#include "hal_i2s.h"
|
||||
#include "hal_dma.h"
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
#include "bflb_platform.h"
|
||||
#include "hal_uart.h"
|
||||
#include <FreeRTOS.h>
|
||||
#include "semphr.h"
|
||||
|
@ -20,6 +20,7 @@
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
#include "bflb_platform.h"
|
||||
#include "hal_uart.h"
|
||||
#include <FreeRTOS.h>
|
||||
#include "semphr.h"
|
||||
|
@ -2,13 +2,13 @@
|
||||
#include "partition.h"
|
||||
#include "blsp_common.h"
|
||||
#include "xz_config.h"
|
||||
#include "blsp_port.h"
|
||||
#include "hal_boot2.h"
|
||||
|
||||
#include "blsp_port.h"
|
||||
#include "hal_boot2.h"
|
||||
#include "bflb_platform.h"
|
||||
|
||||
uint8_t *g_eflash_loader_readbuf[2];
|
||||
volatile uint32_t g_rx_buf_index = 0;
|
||||
volatile uint32_t g_rx_buf_len = 0;
|
||||
volatile uint32_t g_rx_buf_index = 0;
|
||||
volatile uint32_t g_rx_buf_len = 0;
|
||||
uint32_t g_eflash_loader_cmd_ack_buf[16];
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ eflash_loader_if_cfg_t * bflb_eflash_loader_if_set(eflash_loader_if_type_t type)
|
||||
//eflash_loader_if_cfg.boot_if_changerate=bflb_eflash_loader_uart_change_rate;
|
||||
|
||||
return &eflash_loader_if_cfg;
|
||||
#if BLSP_BOOT2_SUPPORT_USB_IAP
|
||||
#if BLSP_BOOT2_SUPPORT_USB_IAP
|
||||
case BFLB_EFLASH_LOADER_IF_USB:
|
||||
eflash_loader_if_cfg.if_type=(uint8_t)BFLB_EFLASH_LOADER_IF_USB;
|
||||
eflash_loader_if_cfg.if_type_onfail=(uint8_t)BFLB_EFLASH_LOADER_IF_UART;
|
||||
@ -49,7 +49,7 @@ eflash_loader_if_cfg_t * bflb_eflash_loader_if_set(eflash_loader_if_type_t type)
|
||||
//eflash_loader_if_cfg.boot_if_changerate=bflb_eflash_loader_uart_change_rate;
|
||||
|
||||
return &eflash_loader_if_cfg;
|
||||
#endif
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -87,82 +87,82 @@ int32_t bflb_eflash_loader_if_deinit()
|
||||
return eflash_loader_if_cfg.boot_if_deinit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
int32_t bflb_eflash_loader_main()
|
||||
{
|
||||
int32_t ret;
|
||||
uint32_t total_len;
|
||||
uint32_t i, tmp, cmd_len;
|
||||
uint8_t *recv_buf = NULL;
|
||||
uint8_t err_cnt = 0;
|
||||
uint8_t to_cnt = 0;
|
||||
|
||||
MSG("bflb_eflash_loader_main\r\n");
|
||||
pt_table_dump();
|
||||
ret = pt_table_get_iap_para(&p_iap_param);
|
||||
if(0 != ret){
|
||||
MSG("no valid partition table\r\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
to_cnt = 0;
|
||||
total_len = 0;
|
||||
|
||||
do {
|
||||
total_len = 0;
|
||||
recv_buf = (uint8_t *)bflb_eflash_loader_if_read(&total_len);
|
||||
|
||||
if (total_len <= 0) {
|
||||
to_cnt++;
|
||||
}
|
||||
} while (to_cnt < 2 && total_len <= 0);
|
||||
|
||||
if (to_cnt >= 2 || total_len <= 0) {
|
||||
MSG("rcv err break\r\n");
|
||||
break;
|
||||
}
|
||||
|
||||
MSG("Recv\r\n");
|
||||
//eflash_loader_dump_data(recv_buf,total_len);
|
||||
cmd_len = recv_buf[2] + (recv_buf[3] << 8);
|
||||
MSG("cmd_len %d\r\n", cmd_len);
|
||||
|
||||
/* Check checksum*/
|
||||
if (recv_buf[1] != 0) {
|
||||
tmp = 0;
|
||||
|
||||
for (i = 2; i < cmd_len + 4; i++) {
|
||||
tmp += recv_buf[i];
|
||||
}
|
||||
|
||||
if ((tmp & 0xff) != recv_buf[1]) {
|
||||
/* FL+Error code(2bytes) */
|
||||
MSG("Checksum error %02x\r\n", tmp & 0xff);
|
||||
g_eflash_loader_cmd_ack_buf[0] = BFLB_EFLASH_LOADER_CMD_NACK | ((BFLB_EFLASH_LOADER_CMD_CRC_ERROR << 16) & 0xffff0000);
|
||||
bflb_eflash_loader_if_write(g_eflash_loader_cmd_ack_buf, 4);//ToDo
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
ret = bflb_eflash_loader_cmd_process(recv_buf[0], recv_buf + 4, cmd_len);
|
||||
|
||||
if (ret != BFLB_EFLASH_LOADER_SUCCESS) {
|
||||
MSG(" CMD Pro Ret %d\r\n", ret);
|
||||
|
||||
err_cnt++;
|
||||
|
||||
if (err_cnt > 2) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* read data finished,deinit and go on*/
|
||||
bflb_eflash_loader_if_deinit();//ToDo
|
||||
{
|
||||
int32_t ret;
|
||||
uint32_t total_len;
|
||||
uint32_t i, tmp, cmd_len;
|
||||
uint8_t *recv_buf = NULL;
|
||||
uint8_t err_cnt = 0;
|
||||
uint8_t to_cnt = 0;
|
||||
|
||||
MSG("bflb_eflash_loader_main\r\n");
|
||||
pt_table_dump();
|
||||
ret = pt_table_get_iap_para(&p_iap_param);
|
||||
if(0 != ret){
|
||||
MSG("no valid partition table\r\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
to_cnt = 0;
|
||||
total_len = 0;
|
||||
|
||||
do {
|
||||
total_len = 0;
|
||||
recv_buf = (uint8_t *)bflb_eflash_loader_if_read(&total_len);
|
||||
|
||||
if (total_len <= 0) {
|
||||
to_cnt++;
|
||||
}
|
||||
} while (to_cnt < 2 && total_len <= 0);
|
||||
|
||||
if (to_cnt >= 2 || total_len <= 0) {
|
||||
MSG("rcv err break\r\n");
|
||||
break;
|
||||
}
|
||||
|
||||
MSG("Recv\r\n");
|
||||
//eflash_loader_dump_data(recv_buf,total_len);
|
||||
cmd_len = recv_buf[2] + (recv_buf[3] << 8);
|
||||
MSG("cmd_len %d\r\n", cmd_len);
|
||||
|
||||
/* Check checksum*/
|
||||
if (recv_buf[1] != 0) {
|
||||
tmp = 0;
|
||||
|
||||
for (i = 2; i < cmd_len + 4; i++) {
|
||||
tmp += recv_buf[i];
|
||||
}
|
||||
|
||||
if ((tmp & 0xff) != recv_buf[1]) {
|
||||
/* FL+Error code(2bytes) */
|
||||
MSG("Checksum error %02x\r\n", tmp & 0xff);
|
||||
g_eflash_loader_cmd_ack_buf[0] = BFLB_EFLASH_LOADER_CMD_NACK | ((BFLB_EFLASH_LOADER_CMD_CRC_ERROR << 16) & 0xffff0000);
|
||||
bflb_eflash_loader_if_write(g_eflash_loader_cmd_ack_buf, 4);//ToDo
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
ret = bflb_eflash_loader_cmd_process(recv_buf[0], recv_buf + 4, cmd_len);
|
||||
|
||||
if (ret != BFLB_EFLASH_LOADER_SUCCESS) {
|
||||
MSG(" CMD Pro Ret %d\r\n", ret);
|
||||
|
||||
err_cnt++;
|
||||
|
||||
if (err_cnt > 2) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* read data finished,deinit and go on*/
|
||||
bflb_eflash_loader_if_deinit();//ToDo
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "blsp_media_boot.h"
|
||||
#include "softcrc.h"
|
||||
#include "bflb_eflash_loader_interface.h"
|
||||
#include "hal_uart.h"
|
||||
|
||||
extern int main(void);
|
||||
extern struct device *dev_check_hash;
|
||||
@ -180,7 +181,7 @@ static int32_t blsp_mediaboot_parse_one_fw(boot2_image_config *boot_img_cfg, uin
|
||||
|
||||
/* Due to OTA, the flash_offset is changed, so copy from partition info */
|
||||
boot_img_cfg->img_start.flash_offset = img_addr;
|
||||
|
||||
|
||||
/* If sign enable,get pk key and signature*/
|
||||
if(boot_img_cfg->sign_type){
|
||||
/* Read public key */
|
||||
@ -229,7 +230,7 @@ static int32_t blsp_mediaboot_parse_one_fw(boot2_image_config *boot_img_cfg, uin
|
||||
if(ret!=BFLB_BOOT2_SUCCESS){
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
#ifdef BOOT2_MC
|
||||
/* Read signature2*/
|
||||
MSG_DBG("R SIG2\r\n");
|
||||
@ -257,7 +258,7 @@ static int32_t blsp_mediaboot_parse_one_fw(boot2_image_config *boot_img_cfg, uin
|
||||
ret=blsp_mediaboot_read(addr,g_boot2_read_buf,sizeof(boot_aes_config));
|
||||
if(ret!=BFLB_BOOT2_SUCCESS){
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
if(blsp_boot2_dump_critical_flag()){
|
||||
blsp_dump_data(g_boot2_read_buf,sizeof(boot_aes_config));
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user