VSF Documented
sthal_flash.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright(C)2009-2024 by VSF Team *
3 * *
4 * Licensed under the Apache License, Version 2.0 (the "License"); *
5 * you may not use this file except in compliance with the License. *
6 * You may obtain a copy of the License at *
7 * *
8 * http://www.apache.org/licenses/LICENSE-2.0 *
9 * *
10 * Unless required by applicable law or agreed to in writing, software *
11 * distributed under the License is distributed on an "AS IS" BASIS, *
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 * See the License for the specific language governing permissions and *
14 * limitations under the License. *
15 * *
16 ****************************************************************************/
17
18#ifndef __ST_HAL_FLASH_H__
19#define __ST_HAL_FLASH_H__
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25#if defined(HAL_FLASH_MODULE_ENABLED) && VSF_HAL_USE_FLASH == ENABLED
26
27/*============================ INCLUDES ======================================*/
28
29#include "sthal_def.h"
30
31/*============================ MACROS ========================================*/
32
33#define HAL_FLASH_ERROR_NONE 0x00000000U
34#define HAL_FLASH_ERROR_RD 0x00000001U
35#define HAL_FLASH_ERROR_PGS 0x00000002U
36#define HAL_FLASH_ERROR_PGP 0x00000004U
37#define HAL_FLASH_ERROR_PGA 0x00000008U
38#define HAL_FLASH_ERROR_WRP 0x00000010U
39#define HAL_FLASH_ERROR_OPERATION 0x00000020U
40
41/*============================ MACROFIED FUNCTIONS ===========================*/
42/*============================ TYPES =========================================*/
43
44typedef enum {
45 FLASH_PROC_NONE = 0U,
46 FLASH_PROC_SECTERASE,
47 FLASH_PROC_MASSERASE,
48 FLASH_PROC_PROGRAM
49} FLASH_ProcedureTypeDef;
50
51typedef struct {
52 volatile FLASH_ProcedureTypeDef ProcedureOnGoing;
53 volatile uint32_t NbSectorsToErase;
54 volatile uint8_t VoltageForErase;
55 volatile uint32_t Sector;
56 volatile uint32_t Bank;
57 volatile uint32_t Address;
58 HAL_LockTypeDef Lock;
59 volatile uint32_t ErrorCode;
60} FLASH_ProcessTypeDef;
61
62/*============================ GLOBAL VARIABLES ==============================*/
63/*============================ PROTOTYPES ====================================*/
64
66 uint64_t Data);
68 uint64_t Data);
69void HAL_FLASH_IRQHandler(void);
79
80#endif /* defined(HAL_FLASH_MODULE_ENABLED) && VSF_HAL_USE_FLASH == ENABLED */
81
82#ifdef __cplusplus
83}
84#endif
85
86#endif
unsigned uint32_t
Definition stdint.h:9
unsigned long long uint64_t
Definition stdint.h:11
unsigned char uint8_t
Definition stdint.h:5
HAL_StatusTypeDef
Definition sthal_def.h:61
HAL_LockTypeDef
Definition sthal_def.h:68
HAL_StatusTypeDef HAL_FLASH_OB_Launch(void)
Definition sthal_flash.c:69
void HAL_FLASH_IRQHandler(void)
Definition sthal_flash.c:35
uint32_t HAL_FLASH_GetError(void)
Definition sthal_flash.c:74
void HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue)
Definition sthal_flash.c:44
HAL_StatusTypeDef HAL_FLASH_Unlock(void)
Definition sthal_flash.c:49
HAL_StatusTypeDef HAL_FLASH_OB_Lock(void)
Definition sthal_flash.c:64
HAL_StatusTypeDef HAL_FLASH_OB_Unlock(void)
Definition sthal_flash.c:59
void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue)
Definition sthal_flash.c:38
HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint64_t Data)
Definition sthal_flash.c:29
HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data)
Definition sthal_flash.c:23
HAL_StatusTypeDef HAL_FLASH_Lock(void)
Definition sthal_flash.c:54
HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout)
Definition sthal_flash.c:79
Generated from commit: vsfteam/vsf@0c4049f