bs_bcu_app/bsp/bsp_flash.h

60 lines
2.2 KiB
C
Raw Normal View History

2024-11-07 17:24:19 +08:00
/**
****************************************************************************************************
* @file bsp_flash.c
* @author HF_ZQ
* @brief STM32<EFBFBD>ڲ<EFBFBD>FLASH<EFBFBD><EFBFBD>д <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @license Copyright (c) 2020-2050
****************************************************************************************************
**/
#ifndef __STMFLASH_H
#define __STMFLASH_H
#include "drv_sys.h"
/* FLASH<53><48>ʼ<EFBFBD><CABC>ַ */
#define STM32_FLASH_SIZE 0x100000 /* STM32 FLASH <20>ܴ<EFBFBD>С */
#define STM32_FLASH_BASE 0x08000000 /* STM32 FLASH <20><>ʼ<EFBFBD><CABC>ַ */
#define FLASH_WAITETIME 50000 /* FLASH<53>ȴ<EFBFBD><C8B4><EFBFBD>ʱʱ<CAB1><CAB1> */
/* FLASH <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>ַ */
#define ADDR_FLASH_SECTOR_0 ((uint32_t )0x08000000) /* <20><><EFBFBD><EFBFBD>0<EFBFBD><30>ʼ<EFBFBD><CABC>ַ, 16 Kbytes */
#define ADDR_FLASH_SECTOR_1 ((uint32_t )0x08004000) /* <20><><EFBFBD><EFBFBD>1<EFBFBD><31>ʼ<EFBFBD><CABC>ַ, 16 Kbytes */
#define ADDR_FLASH_SECTOR_2 ((uint32_t )0x08008000) /* <20><><EFBFBD><EFBFBD>2<EFBFBD><32>ʼ<EFBFBD><CABC>ַ, 16 Kbytes */
#define ADDR_FLASH_SECTOR_3 ((uint32_t )0x0800C000) /* <20><><EFBFBD><EFBFBD>3<EFBFBD><33>ʼ<EFBFBD><CABC>ַ, 16 Kbytes */
#define ADDR_FLASH_SECTOR_4 ((uint32_t )0x08010000) /* <20><><EFBFBD><EFBFBD>4<EFBFBD><34>ʼ<EFBFBD><CABC>ַ, 64 Kbytes */
#define ADDR_FLASH_SECTOR_5 ((uint32_t )0x08020000) /* <20><><EFBFBD><EFBFBD>5<EFBFBD><35>ʼ<EFBFBD><CABC>ַ, 128 Kbytes */
#define ADDR_FLASH_SECTOR_6 ((uint32_t )0x08040000) /* <20><><EFBFBD><EFBFBD>6<EFBFBD><36>ʼ<EFBFBD><CABC>ַ, 128 Kbytes */
#define ADDR_FLASH_SECTOR_7 ((uint32_t )0x08060000) /* <20><><EFBFBD><EFBFBD>7<EFBFBD><37>ʼ<EFBFBD><CABC>ַ, 128 Kbytes */
#define ADDR_FLASH_SECTOR_8 ((uint32_t )0x08080000) /* <20><><EFBFBD><EFBFBD>8<EFBFBD><38>ʼ<EFBFBD><CABC>ַ, 128 Kbytes */
#define ADDR_FLASH_SECTOR_9 ((uint32_t )0x080A0000) /* <20><><EFBFBD><EFBFBD>9<EFBFBD><39>ʼ<EFBFBD><CABC>ַ, 128 Kbytes */
#define ADDR_FLASH_SECTOR_10 ((uint32_t )0x080C0000) /* <20><><EFBFBD><EFBFBD>10<31><30>ʼ<EFBFBD><CABC>ַ,128 Kbytes */
#define ADDR_FLASH_SECTOR_11 ((uint32_t )0x080E0000) /* <20><><EFBFBD><EFBFBD>11<31><31>ʼ<EFBFBD><CABC>ַ,128 Kbytes */
uint32_t stmflash_read_word(uint32_t faddr); /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
void stmflash_write(uint32_t waddr, uint32_t *pbuf, uint32_t length); /* <20><>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>ʼд<CABC><D0B4>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>ȵ<EFBFBD><C8B5><EFBFBD><EFBFBD><EFBFBD> */
void stmflash_read(uint32_t raddr, uint32_t *pbuf, uint32_t length); /* <20><>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>ȵ<EFBFBD><C8B5><EFBFBD><EFBFBD><EFBFBD> */
void test_write(uint32_t waddr, uint32_t wdata); /* <20><><EFBFBD><EFBFBD>д<EFBFBD><D0B4> */
#endif