/* * Common.h * * Created on: Aug 5, 2024 * Author: fw */ #ifndef __COMMON_H__ #define __COMMON_H__ #define SW_UPDATE_FLASH_BUFFER_SIZE 128 // **** Types **** typedef float F32; ///< 32-bit floating point type typedef double F64; ///< 64-bit floating point type typedef long long S64; ///< 64-bit signed integer type typedef unsigned int U32; ///< 32-bit unsigned integer type typedef int S32; ///< 32-bit signed integer type typedef unsigned short U16; ///< 16-bit unsigned integer type typedef short S16; ///< 16-bit signed integer type typedef unsigned char U08; ///< 8-bit unsigned integer type typedef unsigned int BOOL; ///< 32-bit boolean type typedef unsigned char BYTE; ///< 8-bit byte type typedef enum SW_Update_Destinations { //UPDATE_NONE = 0, UPDATE_FIRMWARE = 0, UPDATE_FPGA, NUM_OF_UPDAT_DESTS } SW_UPDATE_DESINTATIONS_T; typedef enum SW_Update_CAN_Mail_Boxes { SW_UPDATE_NOT_USED = 0, SW_UPDATE_COMMAD, SW_UPDATE_TD_UPDATE, SW_UPDATE_DD_UPDATE, SW_UPDATE_RO_UPDATE, PLACE_HOLDER_TO_REMOVE_CAN, SW_UPDATE_RESP, NUM_OF_SW_UPDATE_MBOXES, } SW_UPDATE_CAN_MAIL_BOXES_T; /*! Normal Protocol: UI->FW: SwUpdateCommand[cmd=start] FW->UI: Secure Ack/Nack loop UI->FW: Data FW->UI: Secure Ack/Nack <- Also flow control. end UI->FW: Verify FW->UI: SwUpdateVerifyResponse UI->FW: Version FW->UI: SwUpdateVerifyResponse UI->FW: Verified UI thinks things are good. FW->UI: ACK/NACK FW has agreed or not and set the FLASH memory that the image is good or not. UI->FW: RunApp Launch the main app. FW->UI: Secure Ack/Nack If streaming encounters problems we use a command with Resync so that the FW will dump it's indexes and be ready for new data. */ typedef enum SW_Update_Commands { UPDATE_CMD_START = 0, UPDATE_CMD_ABORT, UPDATE_CMD_RUNAPP, // TODO is this needed? UPDATE_CMD_VERIFY, UPDATE_CMD_VERSION, // TODO is this needed? UPDATE_CMD_VERIFIED, UPDATE_CMD_RESYNC, NUM_OF_UPDATE_CMDS } SW_UPDATE_CMDS_T; typedef enum Ack_Nack { NACK = 0, ACK, NUM_OF_ACK_NACK } ACK_NACK_STATUS_T; typedef struct { BOOL isSWUpdateBufferReady; SW_UPDATE_DESINTATIONS_T dest; } SW_UPDATE_BUFFER_STATUS_T; #endif