mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-17 02:52:12 +01:00
OP-21/Flight Bootloader
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1642 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
f972b78bfb
commit
c72a5b1cfe
47
flight/PiOS/inc/pios_bl_helper.h
Normal file
47
flight/PiOS/inc/pios_bl_helper.h
Normal file
@ -0,0 +1,47 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @addtogroup PIOS PIOS Core hardware abstraction layer
|
||||
* @{
|
||||
* @addtogroup PIOS_BOOTLOADER Functions
|
||||
* @brief HAL code to interface to the OpenPilot AHRS module
|
||||
* @{
|
||||
*
|
||||
* @file pios_bl_helper.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Bootloader Helper Functions
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef PIOS_BL_HELPER_H_
|
||||
#define PIOS_BL_HELPER_H_
|
||||
|
||||
extern uint8_t *FLASH_If_Read(uint32_t SectorAddress);
|
||||
|
||||
extern uint8_t FLASH_Ini();
|
||||
|
||||
extern uint32_t crc_memory_calc();
|
||||
|
||||
extern void read_description(uint8_t * array);
|
||||
|
||||
extern uint8_t FLASH_Start();
|
||||
|
||||
extern void CRC_Ini();
|
||||
|
||||
|
||||
#endif /* PIOS_BL_HELPER_H_ */
|
@ -50,8 +50,9 @@ extern enum opahrs_result PIOS_OPAHRS_bl_FwupStart(struct opahrs_msg_v0 * req, s
|
||||
extern enum opahrs_result PIOS_OPAHRS_bl_FwupData(struct opahrs_msg_v0 * req, struct opahrs_msg_v0 * rsp);
|
||||
extern enum opahrs_result PIOS_OPAHRS_bl_FwupVerify(struct opahrs_msg_v0 * rsp);
|
||||
extern enum opahrs_result PIOS_OPAHRS_bl_resync(void);
|
||||
|
||||
|
||||
extern enum opahrs_result PIOS_OPAHRS_bl_GetMemMap(struct opahrs_msg_v0 * rsp);
|
||||
extern enum opahrs_result PIOS_OPAHRS_bl_reset();
|
||||
extern enum opahrs_result PIOS_OPAHRS_bl_boot();
|
||||
/*
|
||||
* Protocol V1 messages used by application
|
||||
*/
|
||||
|
@ -85,8 +85,14 @@ struct opahrs_msg_v0_req_fwup_start {
|
||||
} __attribute__((__packed__));
|
||||
|
||||
struct opahrs_msg_v0_req_fwup_data {
|
||||
uint32_t adress;
|
||||
uint32_t data;
|
||||
} __attribute__((__packed__));
|
||||
|
||||
struct opahrs_msg_v0_req_mem_map {
|
||||
} __attribute__((__packed__));
|
||||
|
||||
|
||||
struct opahrs_msg_v0_req_fwup_verify {
|
||||
} __attribute__((__packed__));
|
||||
|
||||
@ -96,6 +102,7 @@ union opahrs_msg_v0_req {
|
||||
struct opahrs_msg_v0_req_reset reset;
|
||||
struct opahrs_msg_v0_req_boot boot;
|
||||
struct opahrs_msg_v0_req_serial serial;
|
||||
struct opahrs_msg_v0_req_mem_map mem_map;
|
||||
struct opahrs_msg_v0_req_fwup_start fwup_start;
|
||||
struct opahrs_msg_v0_req_fwup_data fwup_data;
|
||||
struct opahrs_msg_v0_req_fwup_verify fwup_verify;
|
||||
@ -105,19 +112,32 @@ struct opahrs_msg_v0_rsp_versions {
|
||||
uint8_t hw_version;
|
||||
uint16_t bl_version;
|
||||
uint32_t fw_version;
|
||||
uint8_t description[100];
|
||||
} __attribute__((__packed__));
|
||||
|
||||
struct opahrs_msg_v0_rsp_serial {
|
||||
uint8_t serial_bcd[24];
|
||||
} __attribute__((__packed__));
|
||||
|
||||
enum bootloader_status{idle,started,start_failed,write_error,outside_dev_capabilities,jump_failed};
|
||||
struct opahrs_msg_v0_rsp_fwup_status {
|
||||
enum bootloader_status status;
|
||||
} __attribute__((__packed__));
|
||||
|
||||
enum hw_density {high_density,medium_density};
|
||||
struct opahrs_msg_v0_rsp_mem_map {
|
||||
uint32_t start_of_user_code;
|
||||
uint32_t size_of_code_memory;
|
||||
uint8_t size_of_description;
|
||||
uint8_t rw_flags;
|
||||
enum hw_density density;
|
||||
} __attribute__((__packed__));
|
||||
|
||||
union opahrs_msg_v0_rsp {
|
||||
struct opahrs_msg_v0_rsp_versions versions;
|
||||
struct opahrs_msg_v0_rsp_serial serial;
|
||||
struct opahrs_msg_v0_rsp_fwup_status fwup_status;
|
||||
struct opahrs_msg_v0_rsp_mem_map mem_map;
|
||||
} __attribute__((__packed__));
|
||||
|
||||
enum opahrs_msg_v0_tag {
|
||||
@ -127,6 +147,8 @@ enum opahrs_msg_v0_tag {
|
||||
OPAHRS_MSG_V0_REQ_BOOT,
|
||||
OPAHRS_MSG_V0_REQ_SERIAL,
|
||||
|
||||
OPAHRS_MSG_V0_REQ_MEM_MAP,
|
||||
|
||||
OPAHRS_MSG_V0_REQ_FWUP_START,
|
||||
OPAHRS_MSG_V0_REQ_FWUP_DATA,
|
||||
OPAHRS_MSG_V0_REQ_FWUP_VERIFY,
|
||||
@ -134,6 +156,8 @@ enum opahrs_msg_v0_tag {
|
||||
OPAHRS_MSG_V0_RSP_VERSIONS,
|
||||
OPAHRS_MSG_V0_RSP_SERIAL,
|
||||
OPAHRS_MSG_V0_RSP_FWUP_STATUS,
|
||||
|
||||
OPAHRS_MSG_V0_RSP_MEM_MAP,
|
||||
};
|
||||
|
||||
struct opahrs_msg_v0_payload {
|
||||
|
Loading…
x
Reference in New Issue
Block a user