2 * Copyright (c) 2013-2018 Arm Limited. All rights reserved.
4 * SPDX-License-Identifier: Apache-2.0
6 * Licensed under the Apache License, Version 2.0 (the License); you may
7 * not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 #include "Driver_Flash.h"
21 #define ARM_FLASH_DRV_VERSION ARM_DRIVER_VERSION_MAJOR_MINOR(1, 0) /* driver version */
23 /* Sector Information */
25 static ARM_FLASH_SECTOR FLASH_SECTOR_INFO[FLASH_SECTOR_COUNT] = {
29 #define FLASH_SECTOR_INFO NULL
32 /* Flash Information */
33 static ARM_FLASH_INFO FlashInfo = {
34 0, /* FLASH_SECTOR_INFO */
35 0, /* FLASH_SECTOR_COUNT */
36 0, /* FLASH_SECTOR_SIZE */
37 0, /* FLASH_PAGE_SIZE */
38 0, /* FLASH_PROGRAM_UNIT */
39 0 /* FLASH_ERASED_VALUE */
43 static ARM_FLASH_STATUS FlashStatus;
46 static const ARM_DRIVER_VERSION DriverVersion = {
47 ARM_FLASH_API_VERSION,
51 /* Driver Capabilities */
52 static const ARM_FLASH_CAPABILITIES DriverCapabilities = {
54 0, /* data_width = 0:8-bit, 1:16-bit, 2:32-bit */
62 ARM_DRIVER_VERSION ARM_Flash_GetVersion(void)
66 ARM_FLASH_CAPABILITIES ARM_Flash_GetCapabilities(void)
70 int32_t ARM_Flash_Initialize(ARM_Flash_SignalEvent_t cb_event)
74 int32_t ARM_Flash_Uninitialize(void)
78 int32_t ARM_Flash_PowerControl(ARM_POWER_STATE state)
92 return ARM_DRIVER_ERROR_UNSUPPORTED;
96 int32_t ARM_Flash_ReadData(uint32_t addr, void *data, uint32_t cnt)
100 int32_t ARM_Flash_ProgramData(uint32_t addr, const void *data, uint32_t cnt)
104 int32_t ARM_Flash_EraseSector(uint32_t addr)
108 int32_t ARM_Flash_EraseChip(void)
112 ARM_FLASH_STATUS ARM_Flash_GetStatus(void)
116 ARM_FLASH_INFO * ARM_Flash_GetInfo(void)
120 void ARM_Flash_SignalEvent(uint32_t event)
123 // End Flash Interface
125 ARM_DRIVER_FLASH Driver_Flash0 = {
126 ARM_Flash_GetVersion,
127 ARM_Flash_GetCapabilities,
128 ARM_Flash_Initialize,
129 ARM_Flash_Uninitialize,
130 ARM_Flash_PowerControl,
132 ARM_Flash_ProgramData,
133 ARM_Flash_EraseSector,