mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-20 03:13:44 +08:00
NuttX based PX4 bootloader
stm32h7 booloader:Obey VBUS input stm32h7 booloader:Fully deinit systic
This commit is contained in:
committed by
Lorenz Meier
parent
78944a70c3
commit
522ed2d99b
@@ -171,6 +171,9 @@ function(px4_add_common_flags)
|
||||
${PX4_BINARY_DIR}
|
||||
${PX4_BINARY_DIR}/src/lib
|
||||
|
||||
if("${PX4_BOARD_LABEL}" STREQUAL "bootloader")
|
||||
${PX4_SOURCE_DIR}/platforms/${PX4_PLATFORM}/src/bootloader
|
||||
endif()
|
||||
${PX4_SOURCE_DIR}/platforms/${PX4_PLATFORM}/src/px4/${PX4_CHIP_MANUFACTURER}/${PX4_CHIP}/include
|
||||
${PX4_SOURCE_DIR}/platforms/${PX4_PLATFORM}/src/px4/common/include
|
||||
${PX4_SOURCE_DIR}/platforms/common/include
|
||||
|
||||
@@ -47,6 +47,16 @@ get_property(module_libraries GLOBAL PROPERTY PX4_MODULE_LIBRARIES)
|
||||
add_subdirectory(NuttX ${PX4_BINARY_DIR}/NuttX)
|
||||
|
||||
set(nuttx_libs)
|
||||
if("${PX4_BOARD_LABEL}" STREQUAL "bootloader")
|
||||
set(SCRIPT_PREFIX ${PX4_BOARD_LABEL}_)
|
||||
add_subdirectory(src/bootloader)
|
||||
list(APPEND nuttx_libs
|
||||
bootloader
|
||||
bootloader_lib
|
||||
drivers_board
|
||||
)
|
||||
endif()
|
||||
|
||||
list(APPEND nuttx_libs
|
||||
nuttx_apps
|
||||
nuttx_arch
|
||||
@@ -94,7 +104,7 @@ target_link_libraries(px4 PRIVATE
|
||||
-fno-exceptions
|
||||
-fno-rtti
|
||||
|
||||
-Wl,--script=${PX4_BINARY_DIR_CYG}/NuttX/nuttx-config/scripts/script.ld
|
||||
-Wl,--script=${PX4_BINARY_DIR_CYG}/NuttX/nuttx-config/scripts/${SCRIPT_PREFIX}script.ld
|
||||
-Wl,-Map=${PX4_CONFIG}.map
|
||||
-Wl,--warn-common
|
||||
-Wl,--gc-sections
|
||||
@@ -205,6 +215,9 @@ if(NOT PX4_BUILD MATCHES "px4_io-v2")
|
||||
elseif(CONFIG_ARCH_CHIP_STM32F777NI)
|
||||
set(DEBUG_DEVICE "STM32F777NI")
|
||||
set(DEBUG_SVD_FILE "STM32F7x7.svd")
|
||||
elseif(CONFIG_ARCH_CHIP_STM32H743ZI)
|
||||
set(DEBUG_DEVICE "STM32H743ZI")
|
||||
set(DEBUG_SVD_FILE "STM32H7x3.svd")
|
||||
endif()
|
||||
|
||||
file(GLOB_RECURSE DEBUG_SVD_FILE_PATH ${CMAKE_SOURCE_DIR}/../cmsis-svd/*/${DEBUG_SVD_FILE})
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2019 PX4 Development Team. All rights reserved.
|
||||
#
|
||||
# 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 PX4 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 OWNER 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
add_library(bootloader
|
||||
bl.c
|
||||
${PX4_CHIP}/main.c
|
||||
)
|
||||
|
||||
add_subdirectory(lib)
|
||||
add_dependencies(bootloader prebuild_targets)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,130 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2012-2014 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* 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 PX4 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 OWNER 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file bl.h
|
||||
*
|
||||
* Common bootloader definitions.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/*****************************************************************************
|
||||
* Generic bootloader functions.
|
||||
*/
|
||||
|
||||
/* enum for whether bootloading via USB or USART */
|
||||
enum {
|
||||
NONE,
|
||||
USART,
|
||||
USB
|
||||
};
|
||||
|
||||
/* board info forwarded from board-specific code to booloader */
|
||||
struct boardinfo {
|
||||
uint32_t board_type;
|
||||
uint32_t board_rev;
|
||||
uint32_t fw_size;
|
||||
uint32_t systick_mhz; /* systick input clock */
|
||||
|
||||
} __attribute__((packed));
|
||||
|
||||
extern struct boardinfo board_info;
|
||||
|
||||
extern void jump_to_app(void);
|
||||
extern void bootloader(unsigned timeout);
|
||||
extern void delay(unsigned msec);
|
||||
|
||||
#define BL_WAIT_MAGIC 0x19710317 /* magic number in PWR regs to wait in bootloader */
|
||||
|
||||
/* generic timers */
|
||||
#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 */
|
||||
|
||||
/* generic receive buffer for async reads */
|
||||
extern void buf_put(uint8_t b);
|
||||
extern int buf_get(void);
|
||||
|
||||
/*****************************************************************************
|
||||
* Chip/board functions.
|
||||
*/
|
||||
|
||||
/* LEDs */
|
||||
#define LED_ACTIVITY 1
|
||||
#define LED_BOOTLOADER 2
|
||||
|
||||
#ifdef BOOT_DELAY_ADDRESS
|
||||
# define BOOT_DELAY_SIGNATURE1 0x92c2ecff
|
||||
# define BOOT_DELAY_SIGNATURE2 0xc5057d5d
|
||||
# define BOOT_DELAY_MAX 30
|
||||
#endif
|
||||
|
||||
#define MAX_DES_LENGTH 20
|
||||
|
||||
#define arraySize(a) (sizeof((a))/sizeof(((a)[0])))
|
||||
extern void led_on(unsigned led);
|
||||
extern void led_off(unsigned led);
|
||||
extern void led_toggle(unsigned led);
|
||||
|
||||
/* flash helpers from main_*.c */
|
||||
extern void board_deinit(void);
|
||||
extern uint32_t board_get_devices(void);
|
||||
extern void clock_deinit(void);
|
||||
extern uint32_t flash_func_sector_size(unsigned sector);
|
||||
extern void flash_func_erase_sector(unsigned sector);
|
||||
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_sn(uint32_t address);
|
||||
extern void arch_flash_lock(void);
|
||||
extern void arch_flash_unlock(void);
|
||||
extern void arch_setvtor(uint32_t address);
|
||||
void arch_systic_init(void);
|
||||
void arch_systic_deinit(void);
|
||||
|
||||
extern uint32_t get_mcu_id(void);
|
||||
int get_mcu_desc(int max, uint8_t *revstr);
|
||||
extern int check_silicon(void);
|
||||
|
||||
/*****************************************************************************
|
||||
* Interface in/output.
|
||||
*/
|
||||
|
||||
extern void cinit(void *config, uint8_t interface);
|
||||
extern void cfini(void);
|
||||
extern int cin(uint32_t devices);
|
||||
extern void cout(uint8_t *buf, unsigned len);
|
||||
@@ -0,0 +1,46 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2012-2014 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* 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 PX4 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 OWNER 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file cdcacm.h
|
||||
*
|
||||
* cdcacm bootloader definitions.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
extern void usb_cinit(void *config);
|
||||
extern void usb_cfini(void);
|
||||
extern int usb_cin(void);
|
||||
extern void usb_cout(uint8_t *buf, unsigned len);
|
||||
@@ -0,0 +1,41 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2019 PX4 Development Team. All rights reserved.
|
||||
#
|
||||
# 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 PX4 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 OWNER 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
add_library(bootloader_lib
|
||||
systick.c
|
||||
cdcacm.c
|
||||
uart.c
|
||||
flash_cache.c
|
||||
)
|
||||
|
||||
add_dependencies(bootloader_lib prebuild_targets)
|
||||
@@ -0,0 +1,138 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2019 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* 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 PX4 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 OWNER 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "cdcacm.h"
|
||||
#include <string.h>
|
||||
#include<stdio.h>
|
||||
#include<fcntl.h>
|
||||
#include<termios.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/boardctl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <debug.h>
|
||||
#include "cdcacm.h"
|
||||
|
||||
//#define SERIAL_TRACE
|
||||
|
||||
int g_usb_df = -1;
|
||||
char *g_device = 0;
|
||||
char *g_init = 0;
|
||||
|
||||
#if defined(SERIAL_TRACE)
|
||||
int in = 0;
|
||||
int out = 0;
|
||||
char in_trace[254];
|
||||
char out_trace[254];
|
||||
#endif
|
||||
|
||||
void usb_cinit(void *config)
|
||||
{
|
||||
#if defined(SERIAL_TRACE)
|
||||
in = 0;
|
||||
out = 0;
|
||||
memset(in_trace, 0, sizeof(in_trace));
|
||||
memset(out_trace, 0, sizeof(out_trace));
|
||||
#endif
|
||||
g_init = strdup(config ? (char *) config : "");
|
||||
char *pt = strtok((char *) g_init, ",");
|
||||
|
||||
if (pt != NULL) {
|
||||
g_device = pt;
|
||||
}
|
||||
|
||||
int fd = open(g_device, O_RDWR | O_NONBLOCK);
|
||||
|
||||
if (fd >= 0) {
|
||||
g_usb_df = fd;
|
||||
free(g_init);
|
||||
}
|
||||
}
|
||||
void usb_cfini(void)
|
||||
{
|
||||
close(g_usb_df);
|
||||
g_usb_df = -1;
|
||||
}
|
||||
int usb_cin(void)
|
||||
{
|
||||
int c = -1;
|
||||
|
||||
if (g_usb_df < 0) {
|
||||
|
||||
int fd = open(g_device, O_RDWR | O_NONBLOCK);
|
||||
|
||||
if (fd < 0) {
|
||||
return c;
|
||||
}
|
||||
|
||||
g_usb_df = fd;
|
||||
free(g_init);
|
||||
}
|
||||
|
||||
char b;
|
||||
|
||||
if (read(g_usb_df, &b, 1) == 1) {
|
||||
c = b;
|
||||
#if defined(SERIAL_TRACE)
|
||||
in_trace[in] = b;
|
||||
in++;
|
||||
in &= 255;
|
||||
#endif
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
void usb_cout(uint8_t *buf, unsigned len)
|
||||
{
|
||||
uint32_t timeout = 1000;
|
||||
|
||||
for (unsigned i = 0; i < len; i++) {
|
||||
while (timeout) {
|
||||
if (write(g_usb_df, &buf[i], 1) == 1) {
|
||||
#if defined(SERIAL_TRACE)
|
||||
out_trace[out] = buf[i];
|
||||
out++;
|
||||
out &= 255;
|
||||
#endif
|
||||
timeout = 1000;
|
||||
break;
|
||||
|
||||
} else {
|
||||
if (timeout-- == 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2019 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* 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 PX4 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 OWNER 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
#include "flash_cache.h"
|
||||
|
||||
#include "hw_config.h"
|
||||
|
||||
#include <nuttx/progmem.h>
|
||||
|
||||
|
||||
flash_cache_line_t flash_cache[FC_NUMBER_LINES];
|
||||
|
||||
|
||||
static inline void fcl_reset(flash_cache_line_t *fcl)
|
||||
{
|
||||
memset(fcl, 0xff, sizeof(flash_cache_line_t));
|
||||
}
|
||||
|
||||
inline void fc_reset(void)
|
||||
{
|
||||
for (unsigned w = 0; w < FC_NUMBER_LINES; w++) {
|
||||
fcl_reset(&flash_cache[w]);
|
||||
}
|
||||
|
||||
flash_cache[0].start_address = APP_LOAD_ADDRESS;
|
||||
}
|
||||
|
||||
static inline flash_cache_line_t *fc_line_select(uint32_t address)
|
||||
{
|
||||
for (unsigned w = 0; w < FC_NUMBER_LINES; w++) {
|
||||
if (flash_cache[w].start_address == (address & FC_ADDRESS_MASK)) {
|
||||
return &flash_cache[w];
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
inline int fc_is_dirty(flash_cache_line_t *fl)
|
||||
{
|
||||
return fl->index != FC_CLEAN;
|
||||
}
|
||||
|
||||
|
||||
int fc_flush(flash_cache_line_t *fl)
|
||||
{
|
||||
size_t bytes = (fl->index + 1) * sizeof(fl->words[0]);
|
||||
size_t rv = up_progmem_write(fl->start_address, fl->words, bytes);
|
||||
|
||||
if (rv == bytes) {
|
||||
rv = 0;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
int fc_write(uint32_t address, uint32_t word)
|
||||
{
|
||||
flash_cache_line_t *fc = fc_line_select(address);
|
||||
flash_cache_line_t *fc1 = &flash_cache[1];
|
||||
uint32_t index = FC_ADDR2INDX(address);
|
||||
int rv = 0;
|
||||
|
||||
if (fc == NULL && index == 0) {
|
||||
fc = fc1;
|
||||
fc->start_address = address;
|
||||
}
|
||||
|
||||
if (fc) {
|
||||
|
||||
fc->words[index] = word;
|
||||
|
||||
// Are we back writing the first word?
|
||||
|
||||
if (fc == &flash_cache[0] && index == 0 && fc->index == 7) {
|
||||
|
||||
if (fc_is_dirty(fc1)) {
|
||||
|
||||
// write out last fragment of data
|
||||
|
||||
rv = fc_flush(fc1);
|
||||
|
||||
if (rv != 0) {
|
||||
fcl_reset(fc1);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
rv = fc_flush(fc);
|
||||
fcl_reset(fc);
|
||||
return rv;
|
||||
}
|
||||
|
||||
fc->index = index;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
uint32_t fc_read(uint32_t address)
|
||||
{
|
||||
// Assume a cache miss read from FLASH memory
|
||||
|
||||
uint32_t rv = *(uint32_t *) address;
|
||||
|
||||
flash_cache_line_t *fc = fc_line_select(address);
|
||||
|
||||
if (fc) {
|
||||
|
||||
// Cache hit retrieve word from cache
|
||||
|
||||
uint32_t index = FC_ADDR2INDX(address);
|
||||
rv = fc->words[index];
|
||||
|
||||
// Reading the last word in cache (not first words)
|
||||
|
||||
if (fc != &flash_cache[0] && index == FC_LAST_WORD) {
|
||||
if (fc_flush(fc)) {
|
||||
rv ^= 0xffffffff;
|
||||
|
||||
} else {
|
||||
fcl_reset(fc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2019 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* 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 PX4 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 OWNER 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
/* The modern flash controllers manage flash for ECC
|
||||
* On the H7 there is a block size (256) bits
|
||||
* This code translates between the bootloaders word read/write
|
||||
* interface and the H7 need for block based writes.
|
||||
*
|
||||
* All writes* are buffered until 8 word can be written.
|
||||
* Verification is made from the cache. On the verification of the
|
||||
* 8th word all the wordfs in the the cache are written to flash.
|
||||
* If the write fails the value returned for the last word is negated
|
||||
* to ensure an error on verification.
|
||||
*
|
||||
* *writes to the first 8 words of flash at APP_LOAD_ADDRESS
|
||||
* are buffered until the "first word" is written with the real value (not 0xffffffff)
|
||||
*
|
||||
*/
|
||||
|
||||
#define FC_NUMBER_LINES 2 // Number of cache lines.
|
||||
#define FC_NUMBER_WORDS 8 // Number of words per cache line.
|
||||
#define FC_LAST_WORD FC_NUMBER_WORDS-1 // The index of the last word in cache line.
|
||||
#define FC_ADDRESS_MASK ~(sizeof(flash_cache[0].words)-1) // Cache tag from address
|
||||
#define FC_ADDR2INDX(a) (((a) / sizeof(flash_cache[0].words[0])) % FC_NUMBER_WORDS) // index from address
|
||||
#define FC_CLEAN ((uint32_t)-1) // Cache clean
|
||||
|
||||
// Cache line
|
||||
typedef struct flash_cache_line_t {
|
||||
uint32_t index; // Index of word written
|
||||
uint32_t start_address; // cache tag (address in FLASH this is buffering)
|
||||
uint32_t words[FC_NUMBER_WORDS]; // Buffered data
|
||||
} flash_cache_line_t;
|
||||
|
||||
// Resets the cache - all lines flashed and cache_line[0] start_address == APP_LOAD_ADDRESS
|
||||
void fc_reset(void);
|
||||
// Cache operations
|
||||
uint32_t fc_read(uint32_t address);
|
||||
int fc_write(uint32_t address, uint32_t word);
|
||||
@@ -0,0 +1,76 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2019 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* 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 PX4 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 OWNER 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "systick.h"
|
||||
#include <nvic.h>
|
||||
|
||||
uint8_t systick_get_countflag(void)
|
||||
{
|
||||
return (getreg32(NVIC_SYSTICK_CTRL) & NVIC_SYSTICK_CTRL_COUNTFLAG) ? 1 : 0;
|
||||
}
|
||||
|
||||
// See 2.2.3 SysTick external clock is not HCLK/8
|
||||
uint32_t g_divisor = 1;
|
||||
void systick_set_reload(uint32_t value)
|
||||
{
|
||||
putreg32((((value * g_divisor) << NVIC_SYSTICK_RELOAD_SHIFT) & NVIC_SYSTICK_RELOAD_MASK), NVIC_SYSTICK_RELOAD);
|
||||
}
|
||||
|
||||
|
||||
void systick_set_clocksource(uint8_t clocksource)
|
||||
{
|
||||
g_divisor = (clocksource == CLKSOURCE_EXTERNAL) ? 8 : 1;
|
||||
modifyreg32(NVIC_SYSTICK_CTRL, NVIC_SYSTICK_CTRL_CLKSOURCE, clocksource & NVIC_SYSTICK_CTRL_CLKSOURCE);
|
||||
}
|
||||
|
||||
void systick_counter_enable(void)
|
||||
{
|
||||
modifyreg32(NVIC_SYSTICK_CTRL, 0, NVIC_SYSTICK_CTRL_ENABLE);
|
||||
}
|
||||
|
||||
void systick_counter_disable(void)
|
||||
{
|
||||
modifyreg32(NVIC_SYSTICK_CTRL, NVIC_SYSTICK_CTRL_ENABLE, 0);
|
||||
putreg32(0, NVIC_SYSTICK_CURRENT);
|
||||
}
|
||||
|
||||
void systick_interrupt_enable(void)
|
||||
{
|
||||
modifyreg32(NVIC_SYSTICK_CTRL, 0, NVIC_SYSTICK_CTRL_TICKINT);
|
||||
}
|
||||
|
||||
void systick_interrupt_disable(void)
|
||||
{
|
||||
modifyreg32(NVIC_SYSTICK_CTRL, NVIC_SYSTICK_CTRL_TICKINT, 0);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2016 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* 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 PX4 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 OWNER 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#define CLKSOURCE_EXTERNAL 0
|
||||
#define CLKSOURCE_PROCESOR NVIC_SYSTICK_CTRL_CLKSOURCE
|
||||
|
||||
uint8_t systick_get_countflag(void);
|
||||
void systick_set_reload(uint32_t value);
|
||||
void systick_set_clocksource(uint8_t clocksource);
|
||||
void systick_counter_enable(void);
|
||||
void systick_counter_disable(void);
|
||||
void systick_interrupt_enable(void);
|
||||
void systick_interrupt_disable(void);
|
||||
@@ -0,0 +1,130 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2019 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* 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 PX4 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 OWNER 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "uart.h"
|
||||
#include <string.h>
|
||||
#include<stdio.h>
|
||||
#include<fcntl.h>
|
||||
#include<termios.h>
|
||||
//#define SERIAL_TRACE
|
||||
|
||||
int g_uart_df = -1;
|
||||
|
||||
#if defined(SERIAL_TRACE)
|
||||
int in = 0;
|
||||
int out = 0;
|
||||
char in_trace[254];
|
||||
char out_trace[254];
|
||||
#endif
|
||||
|
||||
|
||||
void uart_cinit(void *config)
|
||||
{
|
||||
char *init = strdup(config ? (char *) config : "");
|
||||
char *pt = strtok((char *) init, ",");
|
||||
char *device = "/dev/ttyS0";
|
||||
int baud = 115200;
|
||||
|
||||
if (pt != NULL) {
|
||||
device = pt;
|
||||
pt = strtok(NULL, ",");
|
||||
|
||||
if (pt != NULL) {
|
||||
baud = atol(pt);
|
||||
}
|
||||
}
|
||||
|
||||
int fd = open(device, O_RDWR | O_NONBLOCK);
|
||||
|
||||
if (fd >= 0) {
|
||||
|
||||
g_uart_df = fd;
|
||||
struct termios t;
|
||||
|
||||
tcgetattr(g_uart_df, &t);
|
||||
t.c_cflag &= ~(CSIZE | PARENB | CSTOPB);
|
||||
t.c_cflag |= (CS8);
|
||||
cfsetspeed(&t, baud);
|
||||
tcsetattr(g_uart_df, TCSANOW, &t);
|
||||
}
|
||||
|
||||
free(init);
|
||||
}
|
||||
|
||||
void uart_cfini(void)
|
||||
{
|
||||
close(g_uart_df);
|
||||
g_uart_df = -1;
|
||||
}
|
||||
int uart_cin(void)
|
||||
{
|
||||
int c = -1;
|
||||
|
||||
if (g_uart_df >= 0) {
|
||||
char b;
|
||||
|
||||
if (read(g_uart_df, &b, 1) == 1) {
|
||||
c = b;
|
||||
#if defined(SERIAL_TRACE)
|
||||
in_trace[in] = b;
|
||||
in++;
|
||||
in &= 255;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
void uart_cout(uint8_t *buf, unsigned len)
|
||||
{
|
||||
uint32_t timeout = 1000;
|
||||
|
||||
for (unsigned i = 0; i < len; i++) {
|
||||
while (timeout) {
|
||||
if (write(g_uart_df, &buf[i], 1) == 1) {
|
||||
#if defined(SERIAL_TRACE)
|
||||
out_trace[out] = buf[i];
|
||||
out++;
|
||||
out &= 255;
|
||||
#endif
|
||||
timeout = 1000;
|
||||
break;
|
||||
|
||||
} else {
|
||||
if (timeout-- == 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,45 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2012-2014 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* 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 PX4 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 OWNER 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file uart.h
|
||||
*
|
||||
* UART bootloader definitions.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
extern void uart_cinit(void *config);
|
||||
extern void uart_cfini(void);
|
||||
extern int uart_cin(void);
|
||||
extern void uart_cout(uint8_t *buf, unsigned len);
|
||||
Reference in New Issue
Block a user