2 * Copyright (c) 2013-2020 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 0, /* Asynchronous Mode */
33 0, /* Supports EraseAll operation */
42 static ARM_DRIVER_VERSION ARM_Storage_GetVersion (void) {
46 static ARM_STORAGE_CAPABILITIES ARM_Storage_GetCapabilities (void) {
47 return DriverCapabilities;
50 static int32_t ARM_Storage_Initialize (ARM_Storage_Callback_t callback) {
53 static int32_t ARM_Storage_Uninitialize (void) {
56 static int32_t ARM_Storage_PowerControl (ARM_POWER_STATE state)
72 static int32_t ARM_Storage_ReadData (uint64_t addr, void *data, uint32_t size) {
75 static int32_t ARM_Storage_ProgramData (uint64_t addr, const void *data, uint32_t size) {
78 static int32_t ARM_Storage_Erase (uint64_t addr, uint32_t size) {
81 static int32_t ARM_Storage_EraseAll (void) {
84 static ARM_STORAGE_STATUS ARM_Storage_GetStatus (void) {
87 static int32_t ARM_Storage_GetInfo (ARM_STORAGE_INFO *info) {
90 static uint32_t ARM_Storage_ResolveAddress(uint64_t addr) {
93 static int32_t ARM_Storage_GetNextBlock(const ARM_STORAGE_BLOCK* prev_block, ARM_STORAGE_BLOCK *next_block) {
96 static int32_t ARM_Storage_GetBlock(uint64_t addr, ARM_STORAGE_BLOCK *block) {
99 // End Storage Interface
102 ARM_DRIVER_STORAGE Driver_Storage0;
103 ARM_DRIVER_STORAGE Driver_Storage0 = {
104 ARM_Storage_GetVersion,
105 ARM_Storage_GetCapabilities,
106 ARM_Storage_Initialize,
107 ARM_Storage_Uninitialize,
108 ARM_Storage_PowerControl,
109 ARM_Storage_ReadData,
110 ARM_Storage_ProgramData,
112 ARM_Storage_EraseAll,
113 ARM_Storage_GetStatus,
115 ARM_Storage_ResolveAddress,
116 ARM_Storage_GetNextBlock,