1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- /**
- ******************************************************************************
- * @file : iap.h
- * @brief : Header for iap.c define .
- * This file contains the common defines of the application.
- ******************************************************************************
- * @attention
- *
- * Copyright (c) 2025 STMicroelectronics.
- * All rights reserved.
- *
- * This software is licensed under terms that can be found in the LICENSE file
- * in the root directory of this software component.
- * If no LICENSE file comes with this software, it is provided AS-IS.
- *
- ******************************************************************************
- */
- /* Define to prevent recursive inclusion -------------------------------------*/
- #ifndef __IAP_H
- #define __IAP_H
- #ifdef __cplusplus
- extern "C" {
- #endif
- /* Includes ------------------------------------------------------------------*/
- #include "stm32l4xx_hal.h"
- #include "global_def.h"
- #include "stm32l4xx_hal_flash.h"
- #include "stm32l4xx_hal_flash_ex.h"
- ///<cmd
- #define ControlCmd (0x02)
- #define DataTransferCmd (0x40)
- #define DataTransferCmdHost (0x41)
- ///<smd
- ///<cmd=0x40
- #define DataTransferRequest (0x00)
- #define TransferData (0x01)
- #define TransferExit (0x02)
- ///<cmd=0x02
- #define RequestReset (0x00)
- /* cmd=0x40 smd=0x00 */
- /* Transfer type */
- #define IAP_BIN_FILE (1)
- #define MaxBlockSize (256) //²»Äܳ¬³ö½ÓÊÕbuffer size #define UART0_RECV_DATA_POOL_COUNT 320
- /* Result */
- #define ResultSuccess (0)
- #define ResultBusy (1)
- #define ResultExceedLimit (2)
- #define ResultTotalLengthErr (3)
- #define ResultSequenceErr (4)
- #define ResultCRCErr (5)
- #define ResultParamErr (6)
- #define ResultCmdErr (7)
- #define ResultExecErr (8)
- extern uint8_t iap_reboot;
- /* Exported functions prototypes ---------------------------------------------*/
- extern int IAP_Init(void);
- extern void IAP_Start(void);
- extern int IAP_Write(uint8_t *pdata, uint16_t length);
- extern int IAP_Stop(void);
- extern uint16_t IAP_CmdHandle(uint8_t* pdata, uint16_t length, uint8_t* pout);
- extern void Start_BootLoader(void);
- #ifdef __cplusplus
- }
- #endif
- #endif /* __IAP_H */
|