HPM SDK
HPMicro Software Development Kit
hpm_nor_flash.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2023 HPMicro
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 #ifndef _HPM_NOR_FLASH_H
8 #define _HPM_NOR_FLASH_H
9 
10 #include <stdint.h>
11 #include "hpm_common.h"
12 #include "hpm_romapi.h"
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif /* __cplusplus */
17 
21 #ifndef E2P_PLACE_FLASH
22 #define E2P_ATTR ATTR_RAMFUNC
23 #else
24 #define E2P_ATTR
25 #endif
26 
27 typedef struct {
29  uint32_t base_addr;
30  uint32_t sector_size;
31  uint32_t opt_header;
32  uint32_t opt0;
33  uint32_t opt1;
36 
44 
54 hpm_stat_t nor_flash_read(nor_flash_config_t *cfg, uint8_t *buf, uint32_t addr, uint32_t size);
55 
65 hpm_stat_t nor_flash_write(nor_flash_config_t *cfg, uint8_t *buf, uint32_t addr, uint32_t size);
66 
74 void nor_flash_erase(nor_flash_config_t *cfg, uint32_t start_addr, uint32_t size);
75 
76 #ifdef __cplusplus
77 }
78 #endif /* __cplusplus */
79 #endif
uint32_t hpm_stat_t
Definition: hpm_common.h:123
static void size
Definition: hpm_math.h:6899
uint32_t XPI_Type
XPI_Type definitions for.
Definition: hpm_romapi_xpi_def.h:22
void nor_flash_erase(nor_flash_config_t *cfg, uint32_t start_addr, uint32_t size)
hpm nor-flash erase function
Definition: hpm_nor_flash.c:75
hpm_stat_t nor_flash_write(nor_flash_config_t *cfg, uint8_t *buf, uint32_t addr, uint32_t size)
hpm nor-flash write function
Definition: hpm_nor_flash.c:56
hpm_stat_t nor_flash_init(nor_flash_config_t *cfg)
hpm nor-flash initialization
Definition: hpm_nor_flash.c:24
hpm_stat_t nor_flash_read(nor_flash_config_t *cfg, uint8_t *buf, uint32_t addr, uint32_t size)
hpm nor-flash read function
Definition: hpm_nor_flash.c:42
Definition: hpm_nor_flash.h:27
uint32_t opt0
Definition: hpm_nor_flash.h:32
uint32_t opt1
Definition: hpm_nor_flash.h:33
XPI_Type * xpi_base
Definition: hpm_nor_flash.h:28
uint32_t opt_header
Definition: hpm_nor_flash.h:31
uint32_t sector_size
Definition: hpm_nor_flash.h:30
xpi_nor_config_t nor_config
Definition: hpm_nor_flash.h:34
uint32_t base_addr
Definition: hpm_nor_flash.h:29
XPI NOR configuration structure.
Definition: hpm_romapi_xpi_nor_def.h:261