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.
20 #include "Driver_Storage.h"
22 #define ARM_STORAGE_DRV_VERSION ARM_DRIVER_VERSION_MAJOR_MINOR(1, 0) /* driver version */
25 static const ARM_DRIVER_VERSION DriverVersion = {
26 ARM_STORAGE_API_VERSION,
27 ARM_STORAGE_DRV_VERSION
30 /* Driver Capabilities */
31 static const ARM_STORAGE_CAPABILITIES DriverCapabilities = {
32 1, /* Asynchronous Mode */
33 1, /* Supports EraseAll operation */
42 ARM_DRIVER_VERSION ARM_Storage_GetVersion (void) {
45 ARM_STORAGE_CAPABILITIES ARM_Storage_GetCapabilities (void) {
48 int32_t ARM_Storage_Initialize (ARM_Storage_Callback_t callback) {
51 int32_t ARM_Storage_Uninitialize (void) {
54 int32_t ARM_Storage_PowerControl (ARM_POWER_STATE state)
68 return ARM_DRIVER_ERROR_UNSUPPORTED;
72 int32_t ARM_Storage_ReadData (uint64_t addr, void *data, uint32_t size) {
75 int32_t ARM_Storage_ProgramData (uint64_t addr, const void *data, uint32_t size) {
78 int32_t ARM_Storage_Erase (uint64_t addr, uint32_t size) {
81 int32_t ARM_Storage_EraseAll (void) {
84 ARM_STORAGE_STATUS ARM_Storage_GetStatus (void) {
87 int32_t ARM_Storage_GetInfo (ARM_STORAGE_INFO *info) {
90 uint32_t ARM_Storage_ResolveAddress(uint64_t addr) {
93 int32_t ARM_Storage_GetNextBlock(const ARM_STORAGE_BLOCK* prev_block, ARM_STORAGE_BLOCK *next_block) {
96 int32_t ARM_Storage_GetBlock(uint64_t addr, ARM_STORAGE_BLOCK *block) {
98 // End Storage Interface
100 ARM_DRIVER_STORAGE Driver_STORAGE = {
101 ARM_Storage_GetVersion,
102 ARM_Storage_GetCapabilities,
103 ARM_Storage_Initialize,
104 ARM_Storage_Uninitialize,
105 ARM_Storage_PowerControl,
106 ARM_Storage_ReadData,
107 ARM_Storage_ProgramData,
109 ARM_Storage_EraseAll,
110 ARM_Storage_GetStatus,
112 ARM_Storage_ResolveAddress,
113 ARM_Storage_GetNextBlock,