MW22-02A/APP/Service/onchip_flash.h

36 lines
1.2 KiB
C
Raw Permalink Normal View History

2025-05-21 01:55:40 +00:00
#ifndef _ON_CHIP_FLASH_H_
#define _ON_CHIP_FLASH_H_
//#include "cpu_types.h"
#include "gd32f4xx.h"
typedef unsigned int U32; /* 32-bit unsigned integer */
/*
** GD32flashֻ<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD> bank0<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַΪ0x08000000<EFBFBD><EFBFBD><EFBFBD><EFBFBD>0x0807ffff
** bank0<EFBFBD><EFBFBD>ռ<EFBFBD>Ϊ512KB<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0-3<EFBFBD><EFBFBD>СΪ16KB<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4Ϊ64KB<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>5-7Ϊ128KB
*/
#define ON_CHIP_FLASH_SECTOR_SIZE_16 1024*16
#define ON_CHIP_FLASH_SECTOR_SIZE_64 1024*64
#define ON_CHIP_FLASH_SECTOR_SIZE_128 1024*128
#define EXT_FLASH_SECTOR_SIZE (1024*4)
#define EXT_FLASH_BLOCK_NUM (0)
#define EXT_FLASH_BLOCK_NUM16 (16)
//#define one_byte 1
//#define half_word 2
//#define one_word 3
//RAM_FUNC void OnChip_Flash_init(void);
//RAM_FUNC U8 OnChip_Flash_erase_sector(U16 sectorNo);
//RAM_FUNC U8 OnChip_Flash_write_in_sector(U16 sectNo,U16 offset,U16 cnt,U8 buf[]);
//RAM_FUNC U8 OnChip_Flash_write(U32 addr,U16 cnt, U8 buf[]);
//RAM_FUNC U32 OnChip_Flash_cmd_launch(void);
void OnChip_Flash_read_in_add(uint32_t address,uint16_t cnt,uint8_t*bBuf);
uint8_t OnChip_Flash_write_byte(uint32_t address,uint16_t cnt, uint8_t buf[]);
uint8_t OnChip_Flash_erase_sector(uint16_t sectorNo);
#endif //_ON_CHIP_FLASH_H_