3 Star 1 Fork 1

Arthur Zheng/TheaBoot

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
bl.h 6.02 KB
一键复制 编辑 原始数据 按行查看 历史
Arthur Zheng 提交于 2018-08-08 12:54 . 添加f4版本,USB
/***************************************************************************************************
* TheaBoot *
* Copyright (C) 2018 YiQiChuang(ShanXi) Electronic Technology CO,LTD. *
* Copyright (c) 2012-2014 PX4 Development Team. *
* *
* This file is part of TheaBoot project. *
* *
* @file bl.h *
* @brief *
* @author Arthur Zheng *
* @email 15034186698@163.com *
* @version 0.2.0.0 *
* @date 2018/07/15 *
* *
*--------------------------------------------------------------------------------------------------*
* Remark : *
*--------------------------------------------------------------------------------------------------*
* Change History : *
* <Date> | <Version> | <Author> | <Description> *
*--------------------------------------------------------------------------------------------------*
* 2018/04/19 | 0.1.0.0 | Arthur Zheng | Create file *
* 2018/07/15 | 0.2.0.0 | Arthur Zheng | Restyle the structure of project *
*--------------------------------------------------------------------------------------------------*
* Lisense : BSD 3-Clause *
* *
* 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 __BL_H
#define __BL_H
/* Defination ------------------------------------------------------------------------------------*/
#define MAX_DEVICE_ID_LENGTH 32
#define MAX_DEVICE_SN_LENGTH 32
#define MAX_DEVICE_REV_LENGTH 16
#define MAX_FLASH_STRC_LENGTH 128
#define MAX_DEVICE_DES_LENGTH 64
#define LED_ACTIVITY 1
#define LED_BOOTLOADER 2
/* enum for whether bootloading via USB or USART */
enum Interface_Type
{
NONE,
USART,
USB
};
/* �豸��Ϣ */
struct boardinfo
{
uint8_t id[MAX_DEVICE_ID_LENGTH];
uint8_t sn[MAX_DEVICE_SN_LENGTH];
uint8_t rev[MAX_DEVICE_REV_LENGTH];
uint8_t flash_strc[MAX_FLASH_STRC_LENGTH];
uint8_t device_des[MAX_DEVICE_DES_LENGTH];
uint32_t fw_size;
uint32_t systick_mhz;
}__attribute__((packed));
extern struct boardinfo board_info;
extern void jump_to_app(void);
extern void bootloader(unsigned timeout);
extern void delay(unsigned msec);
extern unsigned char hex_to_char(unsigned char bHex);
/**
* @brief ��ʱ��
*/
#define NTIMERS 4
# define TIMER_BL_WAIT 0
# define TIMER_CIN 1
# define TIMER_LED 2
# define TIMER_DELAY 3
extern volatile unsigned timer[NTIMERS]; /* each timer decrements every millisecond if > 0 */
/**
* @brief �� mian.c �ļ��е���ĺ���
*/
extern void led_on(unsigned led);
extern void led_off(unsigned led);
extern void led_toggle(unsigned led);
extern void board_deinit(void);
extern void clock_deinit(void);
extern uint32_t flash_func_sector_size(unsigned page);
extern void flash_func_erase_sector(unsigned page);
extern void flash_func_write_word(uint32_t address, uint32_t word);
extern uint32_t flash_func_read_word(uint32_t address);
extern uint32_t flash_func_read_otp(uint32_t address);
extern uint32_t flash_func_read_udid(uint32_t address);
extern uint32_t get_mcu_id(void);
/**
* @brief ���ݽӿں���
*/
extern inline void cinit(void *config, uint8_t interface);
extern inline void cfini(void);
extern inline int cin(void);
extern inline void cout(uint8_t *buf, unsigned len);
/* generic receive buffer for async reads */
extern void buf_put(uint8_t b);
extern int buf_get(void);
#endif
/********* Copyright (C) 2018 YiQiChuang(ShanXi) Electronic Technology CO,LTD *****END OF FILE****/
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/zhengyangliu/TheaBoot.git
git@gitee.com:zhengyangliu/TheaBoot.git
zhengyangliu
TheaBoot
TheaBoot
master

搜索帮助