Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

Committer:
sahilmgandhi
Date:
Sun May 14 23:18:57 2017 +0000
Revision:
18:6a4db94011d3
Publishing again

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sahilmgandhi 18:6a4db94011d3 1
sahilmgandhi 18:6a4db94011d3 2 /** \addtogroup hal */
sahilmgandhi 18:6a4db94011d3 3 /** @{*/
sahilmgandhi 18:6a4db94011d3 4 /*
sahilmgandhi 18:6a4db94011d3 5 * Copyright (c) 2006-2016, ARM Limited, All Rights Reserved
sahilmgandhi 18:6a4db94011d3 6 * SPDX-License-Identifier: Apache-2.0
sahilmgandhi 18:6a4db94011d3 7 *
sahilmgandhi 18:6a4db94011d3 8 * Licensed under the Apache License, Version 2.0 (the "License"); you may
sahilmgandhi 18:6a4db94011d3 9 * not use this file except in compliance with the License.
sahilmgandhi 18:6a4db94011d3 10 * You may obtain a copy of the License at
sahilmgandhi 18:6a4db94011d3 11 *
sahilmgandhi 18:6a4db94011d3 12 * http://www.apache.org/licenses/LICENSE-2.0
sahilmgandhi 18:6a4db94011d3 13 *
sahilmgandhi 18:6a4db94011d3 14 * Unless required by applicable law or agreed to in writing, software
sahilmgandhi 18:6a4db94011d3 15 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
sahilmgandhi 18:6a4db94011d3 16 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
sahilmgandhi 18:6a4db94011d3 17 * See the License for the specific language governing permissions and
sahilmgandhi 18:6a4db94011d3 18 * limitations under the License.
sahilmgandhi 18:6a4db94011d3 19 */
sahilmgandhi 18:6a4db94011d3 20
sahilmgandhi 18:6a4db94011d3 21 #ifndef __DRIVER_STORAGE_H
sahilmgandhi 18:6a4db94011d3 22 #define __DRIVER_STORAGE_H
sahilmgandhi 18:6a4db94011d3 23
sahilmgandhi 18:6a4db94011d3 24 #include <stdint.h>
sahilmgandhi 18:6a4db94011d3 25
sahilmgandhi 18:6a4db94011d3 26 #ifdef __cplusplus
sahilmgandhi 18:6a4db94011d3 27 extern "C" {
sahilmgandhi 18:6a4db94011d3 28 #endif // __cplusplus
sahilmgandhi 18:6a4db94011d3 29
sahilmgandhi 18:6a4db94011d3 30 #include "Driver_Common.h"
sahilmgandhi 18:6a4db94011d3 31
sahilmgandhi 18:6a4db94011d3 32 #define ARM_STORAGE_API_VERSION ARM_DRIVER_VERSION_MAJOR_MINOR(1,00) /* API version */
sahilmgandhi 18:6a4db94011d3 33
sahilmgandhi 18:6a4db94011d3 34
sahilmgandhi 18:6a4db94011d3 35 #define _ARM_Driver_Storage_(n) Driver_Storage##n
sahilmgandhi 18:6a4db94011d3 36 #define ARM_Driver_Storage_(n) _ARM_Driver_Storage_(n)
sahilmgandhi 18:6a4db94011d3 37
sahilmgandhi 18:6a4db94011d3 38 #define ARM_STORAGE_INVALID_OFFSET (0xFFFFFFFFFFFFFFFFULL) ///< Invalid address (relative to a storage controller's
sahilmgandhi 18:6a4db94011d3 39 ///< address space). A storage block may never start at this address.
sahilmgandhi 18:6a4db94011d3 40
sahilmgandhi 18:6a4db94011d3 41 #define ARM_STORAGE_INVALID_ADDRESS (0xFFFFFFFFUL) ///< Invalid address within the processor's memory address space.
sahilmgandhi 18:6a4db94011d3 42 ///< Refer to memory-mapped storage, i.e. < \ref ARM_DRIVER_STORAGE::ResolveAddress().
sahilmgandhi 18:6a4db94011d3 43
sahilmgandhi 18:6a4db94011d3 44 /****** Storage specific error codes *****/
sahilmgandhi 18:6a4db94011d3 45 #define ARM_STORAGE_ERROR_NOT_ERASABLE (ARM_DRIVER_ERROR_SPECIFIC - 1) ///< Part (or all) of the range provided to Erase() isn't erasable.
sahilmgandhi 18:6a4db94011d3 46 #define ARM_STORAGE_ERROR_NOT_PROGRAMMABLE (ARM_DRIVER_ERROR_SPECIFIC - 2) ///< Part (or all) of the range provided to ProgramData() isn't programmable.
sahilmgandhi 18:6a4db94011d3 47 #define ARM_STORAGE_ERROR_PROTECTED (ARM_DRIVER_ERROR_SPECIFIC - 3) ///< Part (or all) of the range to Erase() or ProgramData() is protected.
sahilmgandhi 18:6a4db94011d3 48 #define ARM_STORAGE_ERROR_RUNTIME_OR_INTEGRITY_FAILURE (ARM_DRIVER_ERROR_SPECIFIC - 4) ///< Runtime or sanity-check failure.
sahilmgandhi 18:6a4db94011d3 49
sahilmgandhi 18:6a4db94011d3 50 /**
sahilmgandhi 18:6a4db94011d3 51 * \brief Attributes of the storage range within a storage block.
sahilmgandhi 18:6a4db94011d3 52 */
sahilmgandhi 18:6a4db94011d3 53 typedef struct _ARM_STORAGE_BLOCK_ATTRIBUTES {
sahilmgandhi 18:6a4db94011d3 54 uint32_t erasable : 1; ///< Erasing blocks is permitted with a minimum granularity of 'erase_unit'.
sahilmgandhi 18:6a4db94011d3 55 ///< @note: if 'erasable' is 0--i.e. the 'erase' operation isn't available--then
sahilmgandhi 18:6a4db94011d3 56 ///< 'erase_unit' (see below) is immaterial and should be 0.
sahilmgandhi 18:6a4db94011d3 57 uint32_t programmable : 1; ///< Writing to ranges is permitted with a minimum granularity of 'program_unit'.
sahilmgandhi 18:6a4db94011d3 58 ///< Writes are typically achieved through the ProgramData operation (following an erase);
sahilmgandhi 18:6a4db94011d3 59 ///< if storage isn't erasable (see 'erasable' above) but is memory-mapped
sahilmgandhi 18:6a4db94011d3 60 ///< (i.e. 'memory_mapped'), it can be written directly using memory-store operations.
sahilmgandhi 18:6a4db94011d3 61 uint32_t executable : 1; ///< This storage block can hold program data; the processor can fetch and execute code
sahilmgandhi 18:6a4db94011d3 62 ///< sourced from it. Often this is accompanied with the device being 'memory_mapped' (see \ref ARM_STORAGE_INFO).
sahilmgandhi 18:6a4db94011d3 63 uint32_t protectable : 1; ///< The entire block can be protected from program and erase operations. Once protection
sahilmgandhi 18:6a4db94011d3 64 ///< is enabled for a block, its 'erasable' and 'programmable' bits are turned off.
sahilmgandhi 18:6a4db94011d3 65 uint32_t reserved : 28;
sahilmgandhi 18:6a4db94011d3 66 uint32_t erase_unit; ///< Minimum erase size in bytes.
sahilmgandhi 18:6a4db94011d3 67 ///< The offset of the start of the erase-range should also be aligned with this value.
sahilmgandhi 18:6a4db94011d3 68 ///< Applicable if the 'erasable' attribute is set for the block.
sahilmgandhi 18:6a4db94011d3 69 ///< @note: if 'erasable' (see above) is 0--i.e. the 'erase' operation isn't available--then
sahilmgandhi 18:6a4db94011d3 70 ///< 'erase_unit' is immaterial and should be 0.
sahilmgandhi 18:6a4db94011d3 71 uint32_t protection_unit; ///< Minimum protectable size in bytes. Applicable if the 'protectable'
sahilmgandhi 18:6a4db94011d3 72 ///< attribute is set for the block. This should be a divisor of the block's size. A
sahilmgandhi 18:6a4db94011d3 73 ///< block can be considered to be made up of consecutive, individually-protectable fragments.
sahilmgandhi 18:6a4db94011d3 74 } ARM_STORAGE_BLOCK_ATTRIBUTES;
sahilmgandhi 18:6a4db94011d3 75
sahilmgandhi 18:6a4db94011d3 76 /**
sahilmgandhi 18:6a4db94011d3 77 * \brief A storage block is a range of memory with uniform attributes. Storage blocks
sahilmgandhi 18:6a4db94011d3 78 * combine to make up the address map of a storage controller.
sahilmgandhi 18:6a4db94011d3 79 */
sahilmgandhi 18:6a4db94011d3 80 typedef struct _ARM_STORAGE_BLOCK {
sahilmgandhi 18:6a4db94011d3 81 uint64_t addr; ///< This is the start address of the storage block. It is
sahilmgandhi 18:6a4db94011d3 82 ///< expressed as an offset from the start of the storage map
sahilmgandhi 18:6a4db94011d3 83 ///< maintained by the owning storage controller.
sahilmgandhi 18:6a4db94011d3 84 uint64_t size; ///< This is the size of the storage block, in units of bytes.
sahilmgandhi 18:6a4db94011d3 85 ///< Together with addr, it describes a range [addr, addr+size).
sahilmgandhi 18:6a4db94011d3 86 ARM_STORAGE_BLOCK_ATTRIBUTES attributes; ///< Attributes for this block.
sahilmgandhi 18:6a4db94011d3 87 } ARM_STORAGE_BLOCK;
sahilmgandhi 18:6a4db94011d3 88
sahilmgandhi 18:6a4db94011d3 89 /**
sahilmgandhi 18:6a4db94011d3 90 * The check for a valid ARM_STORAGE_BLOCK.
sahilmgandhi 18:6a4db94011d3 91 */
sahilmgandhi 18:6a4db94011d3 92 #define ARM_STORAGE_VALID_BLOCK(BLK) (((BLK)->addr != ARM_STORAGE_INVALID_OFFSET) && ((BLK)->size != 0))
sahilmgandhi 18:6a4db94011d3 93
sahilmgandhi 18:6a4db94011d3 94 /**
sahilmgandhi 18:6a4db94011d3 95 * \brief Values for encoding storage memory-types with respect to programmability.
sahilmgandhi 18:6a4db94011d3 96 *
sahilmgandhi 18:6a4db94011d3 97 * Please ensure that the maximum of the following memory types doesn't exceed 16; we
sahilmgandhi 18:6a4db94011d3 98 * encode this in a 4-bit field within ARM_STORAGE_INFO::programmability.
sahilmgandhi 18:6a4db94011d3 99 */
sahilmgandhi 18:6a4db94011d3 100 #define ARM_STORAGE_PROGRAMMABILITY_RAM (0x0)
sahilmgandhi 18:6a4db94011d3 101 #define ARM_STORAGE_PROGRAMMABILITY_ROM (0x1) ///< Read-only memory.
sahilmgandhi 18:6a4db94011d3 102 #define ARM_STORAGE_PROGRAMMABILITY_WORM (0x2) ///< write-once-read-only-memory (WORM).
sahilmgandhi 18:6a4db94011d3 103 #define ARM_STORAGE_PROGRAMMABILITY_ERASABLE (0x3) ///< re-programmable based on erase. Supports multiple writes.
sahilmgandhi 18:6a4db94011d3 104
sahilmgandhi 18:6a4db94011d3 105 /**
sahilmgandhi 18:6a4db94011d3 106 * Values for encoding data-retention levels for storage blocks.
sahilmgandhi 18:6a4db94011d3 107 *
sahilmgandhi 18:6a4db94011d3 108 * Please ensure that the maximum of the following retention types doesn't exceed 16; we
sahilmgandhi 18:6a4db94011d3 109 * encode this in a 4-bit field within ARM_STORAGE_INFO::retention_level.
sahilmgandhi 18:6a4db94011d3 110 */
sahilmgandhi 18:6a4db94011d3 111 #define ARM_RETENTION_WHILE_DEVICE_ACTIVE (0x0) ///< Data is retained only during device activity.
sahilmgandhi 18:6a4db94011d3 112 #define ARM_RETENTION_ACROSS_SLEEP (0x1) ///< Data is retained across processor sleep.
sahilmgandhi 18:6a4db94011d3 113 #define ARM_RETENTION_ACROSS_DEEP_SLEEP (0x2) ///< Data is retained across processor deep-sleep.
sahilmgandhi 18:6a4db94011d3 114 #define ARM_RETENTION_BATTERY_BACKED (0x3) ///< Data is battery-backed. Device can be powered off.
sahilmgandhi 18:6a4db94011d3 115 #define ARM_RETENTION_NVM (0x4) ///< Data is retained in non-volatile memory.
sahilmgandhi 18:6a4db94011d3 116
sahilmgandhi 18:6a4db94011d3 117 /**
sahilmgandhi 18:6a4db94011d3 118 * Device Data Security Protection Features. Applicable mostly to EXTERNAL_NVM.
sahilmgandhi 18:6a4db94011d3 119 */
sahilmgandhi 18:6a4db94011d3 120 typedef struct _ARM_STORAGE_SECURITY_FEATURES {
sahilmgandhi 18:6a4db94011d3 121 uint32_t acls : 1; ///< Protection against internal software attacks using ACLs.
sahilmgandhi 18:6a4db94011d3 122 uint32_t rollback_protection : 1; ///< Roll-back protection. Set to true if the creator of the storage
sahilmgandhi 18:6a4db94011d3 123 ///< can ensure that an external attacker can't force an
sahilmgandhi 18:6a4db94011d3 124 ///< older firmware to run or to revert back to a previous state.
sahilmgandhi 18:6a4db94011d3 125 uint32_t tamper_proof : 1; ///< Tamper-proof memory (will be deleted on tamper-attempts using board level or chip level sensors).
sahilmgandhi 18:6a4db94011d3 126 uint32_t internal_flash : 1; ///< Internal flash.
sahilmgandhi 18:6a4db94011d3 127 uint32_t reserved1 : 12;
sahilmgandhi 18:6a4db94011d3 128
sahilmgandhi 18:6a4db94011d3 129 /**
sahilmgandhi 18:6a4db94011d3 130 * Encode support for hardening against various classes of attacks.
sahilmgandhi 18:6a4db94011d3 131 */
sahilmgandhi 18:6a4db94011d3 132 uint32_t software_attacks : 1; ///< device software (malware running on the device).
sahilmgandhi 18:6a4db94011d3 133 uint32_t board_level_attacks : 1; ///< board level attacks (debug probes, copy protection fuses.)
sahilmgandhi 18:6a4db94011d3 134 uint32_t chip_level_attacks : 1; ///< chip level attacks (tamper-protection).
sahilmgandhi 18:6a4db94011d3 135 uint32_t side_channel_attacks : 1; ///< side channel attacks.
sahilmgandhi 18:6a4db94011d3 136 uint32_t reserved2 : 12;
sahilmgandhi 18:6a4db94011d3 137 } ARM_STORAGE_SECURITY_FEATURES;
sahilmgandhi 18:6a4db94011d3 138
sahilmgandhi 18:6a4db94011d3 139 #define ARM_STORAGE_PROGRAM_CYCLES_INFINITE (0UL) /**< Infinite or unknown endurance for reprogramming. */
sahilmgandhi 18:6a4db94011d3 140
sahilmgandhi 18:6a4db94011d3 141 /**
sahilmgandhi 18:6a4db94011d3 142 * \brief Storage information. This contains device-metadata. It is the return
sahilmgandhi 18:6a4db94011d3 143 * value from calling GetInfo() on the storage driver.
sahilmgandhi 18:6a4db94011d3 144 *
sahilmgandhi 18:6a4db94011d3 145 * \details These fields serve a different purpose than the ones contained in
sahilmgandhi 18:6a4db94011d3 146 * \ref ARM_STORAGE_CAPABILITIES, which is another structure containing
sahilmgandhi 18:6a4db94011d3 147 * device-level metadata. ARM_STORAGE_CAPABILITIES describes the API
sahilmgandhi 18:6a4db94011d3 148 * capabilities, whereas ARM_STORAGE_INFO describes the device. Furthermore
sahilmgandhi 18:6a4db94011d3 149 * ARM_STORAGE_CAPABILITIES fits within a single word, and is designed to be
sahilmgandhi 18:6a4db94011d3 150 * passed around by value; ARM_STORAGE_INFO, on the other hand, contains
sahilmgandhi 18:6a4db94011d3 151 * metadata which doesn't fit into a single word and requires the use of
sahilmgandhi 18:6a4db94011d3 152 * pointers to be moved around.
sahilmgandhi 18:6a4db94011d3 153 */
sahilmgandhi 18:6a4db94011d3 154 typedef struct _ARM_STORAGE_INFO {
sahilmgandhi 18:6a4db94011d3 155 uint64_t total_storage; ///< Total available storage, in bytes.
sahilmgandhi 18:6a4db94011d3 156 uint32_t program_unit; ///< Minimum programming size in bytes.
sahilmgandhi 18:6a4db94011d3 157 ///< The offset of the start of the program-range should also be aligned with this value.
sahilmgandhi 18:6a4db94011d3 158 ///< Applicable only if the 'programmable' attribute is set for a block.
sahilmgandhi 18:6a4db94011d3 159 ///< @note: setting program_unit to 0 has the effect of disabling the size and alignment
sahilmgandhi 18:6a4db94011d3 160 ///< restrictions (setting it to 1 also has the same effect).
sahilmgandhi 18:6a4db94011d3 161 uint32_t optimal_program_unit; ///< Optimal programming page-size in bytes. Some storage controllers
sahilmgandhi 18:6a4db94011d3 162 ///< have internal buffers into which to receive data. Writing in chunks of
sahilmgandhi 18:6a4db94011d3 163 ///< 'optimal_program_unit' would achieve maximum programming speed.
sahilmgandhi 18:6a4db94011d3 164 ///< Applicable only if the 'programmable' attribute is set for the underlying block(s).
sahilmgandhi 18:6a4db94011d3 165 uint32_t program_cycles; ///< A measure of endurance for reprogramming.
sahilmgandhi 18:6a4db94011d3 166 ///< Use ARM_STORAGE_PROGRAM_CYCLES_INFINITE for infinite or unknown endurance.
sahilmgandhi 18:6a4db94011d3 167 uint32_t erased_value : 1; ///< Contents of erased memory (usually 1 to indicate erased bytes with state 0xFF).
sahilmgandhi 18:6a4db94011d3 168 uint32_t memory_mapped : 1; ///< This storage device has a mapping onto the processor's memory address space.
sahilmgandhi 18:6a4db94011d3 169 ///< @note: For a memory-mapped block which isn't erasable but is programmable (i.e. if
sahilmgandhi 18:6a4db94011d3 170 ///< 'erasable' is set to 0, but 'programmable' is 1), writes should be possible directly to
sahilmgandhi 18:6a4db94011d3 171 ///< the memory-mapped storage without going through the ProgramData operation.
sahilmgandhi 18:6a4db94011d3 172 uint32_t programmability : 4; ///< A value to indicate storage programmability.
sahilmgandhi 18:6a4db94011d3 173 uint32_t retention_level : 4;
sahilmgandhi 18:6a4db94011d3 174 uint32_t reserved : 22;
sahilmgandhi 18:6a4db94011d3 175 ARM_STORAGE_SECURITY_FEATURES security; ///< \ref ARM_STORAGE_SECURITY_FEATURES
sahilmgandhi 18:6a4db94011d3 176 } ARM_STORAGE_INFO;
sahilmgandhi 18:6a4db94011d3 177
sahilmgandhi 18:6a4db94011d3 178 /**
sahilmgandhi 18:6a4db94011d3 179 \brief Operating status of the storage controller.
sahilmgandhi 18:6a4db94011d3 180 */
sahilmgandhi 18:6a4db94011d3 181 typedef struct _ARM_STORAGE_STATUS {
sahilmgandhi 18:6a4db94011d3 182 uint32_t busy : 1; ///< Controller busy flag
sahilmgandhi 18:6a4db94011d3 183 uint32_t error : 1; ///< Read/Program/Erase error flag (cleared on start of next operation)
sahilmgandhi 18:6a4db94011d3 184 } ARM_STORAGE_STATUS;
sahilmgandhi 18:6a4db94011d3 185
sahilmgandhi 18:6a4db94011d3 186 /**
sahilmgandhi 18:6a4db94011d3 187 * \brief Storage Driver API Capabilities.
sahilmgandhi 18:6a4db94011d3 188 *
sahilmgandhi 18:6a4db94011d3 189 * This data structure is designed to fit within a single word so that it can be
sahilmgandhi 18:6a4db94011d3 190 * fetched cheaply using a call to driver->GetCapabilities().
sahilmgandhi 18:6a4db94011d3 191 */
sahilmgandhi 18:6a4db94011d3 192 typedef struct _ARM_STORAGE_CAPABILITIES {
sahilmgandhi 18:6a4db94011d3 193 uint32_t asynchronous_ops : 1; ///< Used to indicate if APIs like initialize,
sahilmgandhi 18:6a4db94011d3 194 ///< read, erase, program, etc. can operate in asynchronous mode.
sahilmgandhi 18:6a4db94011d3 195 ///< Setting this bit to 1 means that the driver is capable
sahilmgandhi 18:6a4db94011d3 196 ///< of launching asynchronous operations; command completion is
sahilmgandhi 18:6a4db94011d3 197 ///< signaled by the invocation of a completion callback. If
sahilmgandhi 18:6a4db94011d3 198 ///< set to 1, drivers may still complete asynchronous
sahilmgandhi 18:6a4db94011d3 199 ///< operations synchronously as necessary--in which case they
sahilmgandhi 18:6a4db94011d3 200 ///< return a positive error code to indicate synchronous completion.
sahilmgandhi 18:6a4db94011d3 201 uint32_t erase_all : 1; ///< Supports EraseAll operation.
sahilmgandhi 18:6a4db94011d3 202 uint32_t reserved : 30;
sahilmgandhi 18:6a4db94011d3 203 } ARM_STORAGE_CAPABILITIES;
sahilmgandhi 18:6a4db94011d3 204
sahilmgandhi 18:6a4db94011d3 205 /**
sahilmgandhi 18:6a4db94011d3 206 * Command opcodes for Storage. Completion callbacks use these codes to refer to
sahilmgandhi 18:6a4db94011d3 207 * completing commands. Refer to \ref ARM_Storage_Callback_t.
sahilmgandhi 18:6a4db94011d3 208 */
sahilmgandhi 18:6a4db94011d3 209 typedef enum _ARM_STORAGE_OPERATION {
sahilmgandhi 18:6a4db94011d3 210 ARM_STORAGE_OPERATION_GET_VERSION,
sahilmgandhi 18:6a4db94011d3 211 ARM_STORAGE_OPERATION_GET_CAPABILITIES,
sahilmgandhi 18:6a4db94011d3 212 ARM_STORAGE_OPERATION_INITIALIZE,
sahilmgandhi 18:6a4db94011d3 213 ARM_STORAGE_OPERATION_UNINITIALIZE,
sahilmgandhi 18:6a4db94011d3 214 ARM_STORAGE_OPERATION_POWER_CONTROL,
sahilmgandhi 18:6a4db94011d3 215 ARM_STORAGE_OPERATION_READ_DATA,
sahilmgandhi 18:6a4db94011d3 216 ARM_STORAGE_OPERATION_PROGRAM_DATA,
sahilmgandhi 18:6a4db94011d3 217 ARM_STORAGE_OPERATION_ERASE,
sahilmgandhi 18:6a4db94011d3 218 ARM_STORAGE_OPERATION_ERASE_ALL,
sahilmgandhi 18:6a4db94011d3 219 ARM_STORAGE_OPERATION_GET_STATUS,
sahilmgandhi 18:6a4db94011d3 220 ARM_STORAGE_OPERATION_GET_INFO,
sahilmgandhi 18:6a4db94011d3 221 ARM_STORAGE_OPERATION_RESOLVE_ADDRESS,
sahilmgandhi 18:6a4db94011d3 222 ARM_STORAGE_OPERATION_GET_NEXT_BLOCK,
sahilmgandhi 18:6a4db94011d3 223 ARM_STORAGE_OPERATION_GET_BLOCK
sahilmgandhi 18:6a4db94011d3 224 } ARM_STORAGE_OPERATION;
sahilmgandhi 18:6a4db94011d3 225
sahilmgandhi 18:6a4db94011d3 226 /**
sahilmgandhi 18:6a4db94011d3 227 * Declaration of the callback-type for command completion.
sahilmgandhi 18:6a4db94011d3 228 *
sahilmgandhi 18:6a4db94011d3 229 * @param [in] status
sahilmgandhi 18:6a4db94011d3 230 * A code to indicate the status of the completed operation. For data
sahilmgandhi 18:6a4db94011d3 231 * transfer operations, the status field is overloaded in case of
sahilmgandhi 18:6a4db94011d3 232 * success to return the count of items successfully transferred; this
sahilmgandhi 18:6a4db94011d3 233 * can be done safely because error codes are negative values.
sahilmgandhi 18:6a4db94011d3 234 *
sahilmgandhi 18:6a4db94011d3 235 * @param [in] operation
sahilmgandhi 18:6a4db94011d3 236 * The command op-code. This value isn't essential for the callback in
sahilmgandhi 18:6a4db94011d3 237 * the presence of the command instance-id, but it is expected that
sahilmgandhi 18:6a4db94011d3 238 * this information could be a quick and useful filter.
sahilmgandhi 18:6a4db94011d3 239 */
sahilmgandhi 18:6a4db94011d3 240 typedef void (*ARM_Storage_Callback_t)(int32_t status, ARM_STORAGE_OPERATION operation);
sahilmgandhi 18:6a4db94011d3 241
sahilmgandhi 18:6a4db94011d3 242 /**
sahilmgandhi 18:6a4db94011d3 243 * This is the set of operations constituting the Storage driver. Their
sahilmgandhi 18:6a4db94011d3 244 * implementation is platform-specific, and needs to be supplied by the
sahilmgandhi 18:6a4db94011d3 245 * porting effort.
sahilmgandhi 18:6a4db94011d3 246 *
sahilmgandhi 18:6a4db94011d3 247 * Some APIs within `ARM_DRIVER_STORAGE` will always operate synchronously:
sahilmgandhi 18:6a4db94011d3 248 * GetVersion, GetCapabilities, GetStatus, GetInfo, ResolveAddress,
sahilmgandhi 18:6a4db94011d3 249 * GetNextBlock, and GetBlock. This means that control returns to the caller
sahilmgandhi 18:6a4db94011d3 250 * with a relevant status code only after the completion of the operation (or
sahilmgandhi 18:6a4db94011d3 251 * the discovery of a failure condition).
sahilmgandhi 18:6a4db94011d3 252 *
sahilmgandhi 18:6a4db94011d3 253 * The remainder of the APIs: Initialize, Uninitialize, PowerControl, ReadData,
sahilmgandhi 18:6a4db94011d3 254 * ProgramData, Erase, EraseAll, can function asynchronously if the underlying
sahilmgandhi 18:6a4db94011d3 255 * controller supports it--i.e. if ARM_STORAGE_CAPABILITIES::asynchronous_ops is
sahilmgandhi 18:6a4db94011d3 256 * set. In the case of asynchronous operation, the invocation returns early
sahilmgandhi 18:6a4db94011d3 257 * (with ARM_DRIVER_OK) and results in a completion callback later. If
sahilmgandhi 18:6a4db94011d3 258 * ARM_STORAGE_CAPABILITIES::asynchronous_ops is not set, then all such APIs
sahilmgandhi 18:6a4db94011d3 259 * execute synchronously, and control returns to the caller with a status code
sahilmgandhi 18:6a4db94011d3 260 * only after the completion of the operation (or the discovery of a failure
sahilmgandhi 18:6a4db94011d3 261 * condition).
sahilmgandhi 18:6a4db94011d3 262 *
sahilmgandhi 18:6a4db94011d3 263 * If ARM_STORAGE_CAPABILITIES::asynchronous_ops is set, a storage driver may
sahilmgandhi 18:6a4db94011d3 264 * still choose to execute asynchronous operations in a synchronous manner. If
sahilmgandhi 18:6a4db94011d3 265 * so, the driver returns a positive value to indicate successful synchronous
sahilmgandhi 18:6a4db94011d3 266 * completion (or an error code in case of failure) and no further invocation of
sahilmgandhi 18:6a4db94011d3 267 * completion callback should be expected. The expected return value for
sahilmgandhi 18:6a4db94011d3 268 * synchronous completion of such asynchronous operations varies depending on
sahilmgandhi 18:6a4db94011d3 269 * the operation. For operations involving data access, it often equals the
sahilmgandhi 18:6a4db94011d3 270 * amount of data transferred or affected. For non data-transfer operations,
sahilmgandhi 18:6a4db94011d3 271 * such as EraseAll or Initialize, it is usually 1.
sahilmgandhi 18:6a4db94011d3 272 *
sahilmgandhi 18:6a4db94011d3 273 * Here's a code snippet to suggest how asynchronous APIs might be used by
sahilmgandhi 18:6a4db94011d3 274 * callers to handle both synchronous and asynchronous execution by the
sahilmgandhi 18:6a4db94011d3 275 * underlying storage driver:
sahilmgandhi 18:6a4db94011d3 276 * \code
sahilmgandhi 18:6a4db94011d3 277 * ASSERT(ARM_DRIVER_OK == 0); // this is a precondition; it doesn't need to be put in code
sahilmgandhi 18:6a4db94011d3 278 * int32_t returnValue = drv->asynchronousAPI(...);
sahilmgandhi 18:6a4db94011d3 279 * if (returnValue < ARM_DRIVER_OK) {
sahilmgandhi 18:6a4db94011d3 280 * // handle error.
sahilmgandhi 18:6a4db94011d3 281 * } else if (returnValue == ARM_DRIVER_OK) {
sahilmgandhi 18:6a4db94011d3 282 * ASSERT(drv->GetCapabilities().asynchronous_ops == 1);
sahilmgandhi 18:6a4db94011d3 283 * // handle early return from asynchronous execution; remainder of the work is done in the callback handler.
sahilmgandhi 18:6a4db94011d3 284 * } else {
sahilmgandhi 18:6a4db94011d3 285 * ASSERT(returnValue == EXPECTED_RETURN_VALUE_FOR_SYNCHRONOUS_COMPLETION);
sahilmgandhi 18:6a4db94011d3 286 * // handle synchronous completion.
sahilmgandhi 18:6a4db94011d3 287 * }
sahilmgandhi 18:6a4db94011d3 288 * \endcode
sahilmgandhi 18:6a4db94011d3 289 */
sahilmgandhi 18:6a4db94011d3 290 typedef struct _ARM_DRIVER_STORAGE {
sahilmgandhi 18:6a4db94011d3 291 /**
sahilmgandhi 18:6a4db94011d3 292 * \brief Get driver version.
sahilmgandhi 18:6a4db94011d3 293 *
sahilmgandhi 18:6a4db94011d3 294 * The function GetVersion() returns version information of the driver implementation in ARM_DRIVER_VERSION.
sahilmgandhi 18:6a4db94011d3 295 *
sahilmgandhi 18:6a4db94011d3 296 * - API version is the version of the CMSIS-Driver specification used to implement this driver.
sahilmgandhi 18:6a4db94011d3 297 * - Driver version is source code version of the actual driver implementation.
sahilmgandhi 18:6a4db94011d3 298 *
sahilmgandhi 18:6a4db94011d3 299 * Example:
sahilmgandhi 18:6a4db94011d3 300 * \code
sahilmgandhi 18:6a4db94011d3 301 * extern ARM_DRIVER_STORAGE *drv_info;
sahilmgandhi 18:6a4db94011d3 302 *
sahilmgandhi 18:6a4db94011d3 303 * void read_version (void) {
sahilmgandhi 18:6a4db94011d3 304 * ARM_DRIVER_VERSION version;
sahilmgandhi 18:6a4db94011d3 305 *
sahilmgandhi 18:6a4db94011d3 306 * version = drv_info->GetVersion ();
sahilmgandhi 18:6a4db94011d3 307 * if (version.api < 0x10A) { // requires at minimum API version 1.10 or higher
sahilmgandhi 18:6a4db94011d3 308 * // error handling
sahilmgandhi 18:6a4db94011d3 309 * return;
sahilmgandhi 18:6a4db94011d3 310 * }
sahilmgandhi 18:6a4db94011d3 311 * }
sahilmgandhi 18:6a4db94011d3 312 * \endcode
sahilmgandhi 18:6a4db94011d3 313 *
sahilmgandhi 18:6a4db94011d3 314 * @return \ref ARM_DRIVER_VERSION.
sahilmgandhi 18:6a4db94011d3 315 *
sahilmgandhi 18:6a4db94011d3 316 * @note This API returns synchronously--it does not result in an invocation
sahilmgandhi 18:6a4db94011d3 317 * of a completion callback.
sahilmgandhi 18:6a4db94011d3 318 *
sahilmgandhi 18:6a4db94011d3 319 * @note The function GetVersion() can be called any time to obtain the
sahilmgandhi 18:6a4db94011d3 320 * required information from the driver (even before initialization). It
sahilmgandhi 18:6a4db94011d3 321 * always returns the same information.
sahilmgandhi 18:6a4db94011d3 322 */
sahilmgandhi 18:6a4db94011d3 323 ARM_DRIVER_VERSION (*GetVersion)(void);
sahilmgandhi 18:6a4db94011d3 324
sahilmgandhi 18:6a4db94011d3 325 /**
sahilmgandhi 18:6a4db94011d3 326 * \brief Get driver capabilities.
sahilmgandhi 18:6a4db94011d3 327 *
sahilmgandhi 18:6a4db94011d3 328 * \details The function GetCapabilities() returns information about
sahilmgandhi 18:6a4db94011d3 329 * capabilities in this driver implementation. The data fields of the struct
sahilmgandhi 18:6a4db94011d3 330 * ARM_STORAGE_CAPABILITIES encode various capabilities, for example if the device
sahilmgandhi 18:6a4db94011d3 331 * is able to execute operations asynchronously.
sahilmgandhi 18:6a4db94011d3 332 *
sahilmgandhi 18:6a4db94011d3 333 * Example:
sahilmgandhi 18:6a4db94011d3 334 * \code
sahilmgandhi 18:6a4db94011d3 335 * extern ARM_DRIVER_STORAGE *drv_info;
sahilmgandhi 18:6a4db94011d3 336 *
sahilmgandhi 18:6a4db94011d3 337 * void read_capabilities (void) {
sahilmgandhi 18:6a4db94011d3 338 * ARM_STORAGE_CAPABILITIES drv_capabilities;
sahilmgandhi 18:6a4db94011d3 339 *
sahilmgandhi 18:6a4db94011d3 340 * drv_capabilities = drv_info->GetCapabilities ();
sahilmgandhi 18:6a4db94011d3 341 * // interrogate capabilities
sahilmgandhi 18:6a4db94011d3 342 *
sahilmgandhi 18:6a4db94011d3 343 * }
sahilmgandhi 18:6a4db94011d3 344 * \endcode
sahilmgandhi 18:6a4db94011d3 345 *
sahilmgandhi 18:6a4db94011d3 346 * @return \ref ARM_STORAGE_CAPABILITIES.
sahilmgandhi 18:6a4db94011d3 347 *
sahilmgandhi 18:6a4db94011d3 348 * @note This API returns synchronously--it does not result in an invocation
sahilmgandhi 18:6a4db94011d3 349 * of a completion callback.
sahilmgandhi 18:6a4db94011d3 350 *
sahilmgandhi 18:6a4db94011d3 351 * @note The function GetCapabilities() can be called any time to obtain the
sahilmgandhi 18:6a4db94011d3 352 * required information from the driver (even before initialization). It
sahilmgandhi 18:6a4db94011d3 353 * always returns the same information.
sahilmgandhi 18:6a4db94011d3 354 */
sahilmgandhi 18:6a4db94011d3 355 ARM_STORAGE_CAPABILITIES (*GetCapabilities)(void);
sahilmgandhi 18:6a4db94011d3 356
sahilmgandhi 18:6a4db94011d3 357 /**
sahilmgandhi 18:6a4db94011d3 358 * \brief Initialize the Storage Interface.
sahilmgandhi 18:6a4db94011d3 359 *
sahilmgandhi 18:6a4db94011d3 360 * The function Initialize is called when the middleware component starts
sahilmgandhi 18:6a4db94011d3 361 * operation. In addition to bringing the controller to a ready state,
sahilmgandhi 18:6a4db94011d3 362 * Initialize() receives a callback handler to be invoked upon completion of
sahilmgandhi 18:6a4db94011d3 363 * asynchronous operations.
sahilmgandhi 18:6a4db94011d3 364 *
sahilmgandhi 18:6a4db94011d3 365 * Initialize() needs to be called explicitly before
sahilmgandhi 18:6a4db94011d3 366 * powering the peripheral using PowerControl(), and before initiating other
sahilmgandhi 18:6a4db94011d3 367 * accesses to the storage controller.
sahilmgandhi 18:6a4db94011d3 368 *
sahilmgandhi 18:6a4db94011d3 369 * The function performs the following operations:
sahilmgandhi 18:6a4db94011d3 370 * - Initializes the resources needed for the Storage interface.
sahilmgandhi 18:6a4db94011d3 371 * - Registers the \ref ARM_Storage_Callback_t callback function.
sahilmgandhi 18:6a4db94011d3 372 *
sahilmgandhi 18:6a4db94011d3 373 * To start working with a peripheral the functions Initialize and PowerControl need to be called in this order:
sahilmgandhi 18:6a4db94011d3 374 * drv->Initialize (...); // Allocate I/O pins
sahilmgandhi 18:6a4db94011d3 375 * drv->PowerControl (ARM_POWER_FULL); // Power up peripheral, setup IRQ/DMA
sahilmgandhi 18:6a4db94011d3 376 *
sahilmgandhi 18:6a4db94011d3 377 * - Initialize() typically allocates the I/O resources (pins) for the
sahilmgandhi 18:6a4db94011d3 378 * peripheral. The function can be called multiple times; if the I/O resources
sahilmgandhi 18:6a4db94011d3 379 * are already initialized it performs no operation and just returns with
sahilmgandhi 18:6a4db94011d3 380 * ARM_DRIVER_OK.
sahilmgandhi 18:6a4db94011d3 381 *
sahilmgandhi 18:6a4db94011d3 382 * - PowerControl (ARM_POWER_FULL) sets the peripheral registers including
sahilmgandhi 18:6a4db94011d3 383 * interrupt (NVIC) and optionally DMA. The function can be called multiple
sahilmgandhi 18:6a4db94011d3 384 * times; if the registers are already set it performs no operation and just
sahilmgandhi 18:6a4db94011d3 385 * returns with ARM_DRIVER_OK.
sahilmgandhi 18:6a4db94011d3 386 *
sahilmgandhi 18:6a4db94011d3 387 * To stop working with a peripheral the functions PowerControl and Uninitialize need to be called in this order:
sahilmgandhi 18:6a4db94011d3 388 * drv->PowerControl (ARM_POWER_OFF); // Terminate any pending transfers, reset IRQ/DMA, power off peripheral
sahilmgandhi 18:6a4db94011d3 389 * drv->Uninitialize (...); // Release I/O pins
sahilmgandhi 18:6a4db94011d3 390 *
sahilmgandhi 18:6a4db94011d3 391 * The functions PowerControl and Uninitialize always execute and can be used
sahilmgandhi 18:6a4db94011d3 392 * to put the peripheral into a Safe State, for example after any data
sahilmgandhi 18:6a4db94011d3 393 * transmission errors. To restart the peripheral in an error condition,
sahilmgandhi 18:6a4db94011d3 394 * you should first execute the Stop Sequence and then the Start Sequence.
sahilmgandhi 18:6a4db94011d3 395 *
sahilmgandhi 18:6a4db94011d3 396 * @param [in] callback
sahilmgandhi 18:6a4db94011d3 397 * Caller-defined callback to be invoked upon command completion
sahilmgandhi 18:6a4db94011d3 398 * for asynchronous APIs (including the completion of
sahilmgandhi 18:6a4db94011d3 399 * initialization). Use a NULL pointer when no callback
sahilmgandhi 18:6a4db94011d3 400 * signals are required.
sahilmgandhi 18:6a4db94011d3 401 *
sahilmgandhi 18:6a4db94011d3 402 * @note This API may execute asynchronously if
sahilmgandhi 18:6a4db94011d3 403 * ARM_STORAGE_CAPABILITIES::asynchronous_ops is set. Asynchronous
sahilmgandhi 18:6a4db94011d3 404 * execution is optional even if 'asynchronous_ops' is set.
sahilmgandhi 18:6a4db94011d3 405 *
sahilmgandhi 18:6a4db94011d3 406 * @return If asynchronous activity is launched, an invocation returns
sahilmgandhi 18:6a4db94011d3 407 * ARM_DRIVER_OK, and the caller can expect to receive a callback in the
sahilmgandhi 18:6a4db94011d3 408 * future with a status value of ARM_DRIVER_OK or an error-code. In the
sahilmgandhi 18:6a4db94011d3 409 * case of synchronous execution, control returns after completion with a
sahilmgandhi 18:6a4db94011d3 410 * value of 1. Return values less than ARM_DRIVER_OK (0) signify errors.
sahilmgandhi 18:6a4db94011d3 411 */
sahilmgandhi 18:6a4db94011d3 412 int32_t (*Initialize)(ARM_Storage_Callback_t callback);
sahilmgandhi 18:6a4db94011d3 413
sahilmgandhi 18:6a4db94011d3 414 /**
sahilmgandhi 18:6a4db94011d3 415 * \brief De-initialize the Storage Interface.
sahilmgandhi 18:6a4db94011d3 416 *
sahilmgandhi 18:6a4db94011d3 417 * The function Uninitialize() de-initializes the resources of Storage interface.
sahilmgandhi 18:6a4db94011d3 418 *
sahilmgandhi 18:6a4db94011d3 419 * It is called when the middleware component stops operation, and wishes to
sahilmgandhi 18:6a4db94011d3 420 * release the software resources used by the interface.
sahilmgandhi 18:6a4db94011d3 421 *
sahilmgandhi 18:6a4db94011d3 422 * @note This API may execute asynchronously if
sahilmgandhi 18:6a4db94011d3 423 * ARM_STORAGE_CAPABILITIES::asynchronous_ops is set. Asynchronous
sahilmgandhi 18:6a4db94011d3 424 * execution is optional even if 'asynchronous_ops' is set.
sahilmgandhi 18:6a4db94011d3 425 *
sahilmgandhi 18:6a4db94011d3 426 * @return If asynchronous activity is launched, an invocation returns
sahilmgandhi 18:6a4db94011d3 427 * ARM_DRIVER_OK, and the caller can expect to receive a callback in the
sahilmgandhi 18:6a4db94011d3 428 * future with a status value of ARM_DRIVER_OK or an error-code. In the
sahilmgandhi 18:6a4db94011d3 429 * case of synchronous execution, control returns after completion with a
sahilmgandhi 18:6a4db94011d3 430 * value of 1. Return values less than ARM_DRIVER_OK (0) signify errors.
sahilmgandhi 18:6a4db94011d3 431 */
sahilmgandhi 18:6a4db94011d3 432 int32_t (*Uninitialize)(void);
sahilmgandhi 18:6a4db94011d3 433
sahilmgandhi 18:6a4db94011d3 434 /**
sahilmgandhi 18:6a4db94011d3 435 * \brief Control the Storage interface power.
sahilmgandhi 18:6a4db94011d3 436 *
sahilmgandhi 18:6a4db94011d3 437 * The function \b ARM_Storage_PowerControl operates the power modes of the Storage interface.
sahilmgandhi 18:6a4db94011d3 438 *
sahilmgandhi 18:6a4db94011d3 439 * To start working with a peripheral the functions Initialize and PowerControl need to be called in this order:
sahilmgandhi 18:6a4db94011d3 440 * drv->Initialize (...); // Allocate I/O pins
sahilmgandhi 18:6a4db94011d3 441 * drv->PowerControl (ARM_POWER_FULL); // Power up peripheral, setup IRQ/DMA
sahilmgandhi 18:6a4db94011d3 442 *
sahilmgandhi 18:6a4db94011d3 443 * - Initialize() typically allocates the I/O resources (pins) for the
sahilmgandhi 18:6a4db94011d3 444 * peripheral. The function can be called multiple times; if the I/O resources
sahilmgandhi 18:6a4db94011d3 445 * are already initialized it performs no operation and just returns with
sahilmgandhi 18:6a4db94011d3 446 * ARM_DRIVER_OK.
sahilmgandhi 18:6a4db94011d3 447 *
sahilmgandhi 18:6a4db94011d3 448 * - PowerControl (ARM_POWER_FULL) sets the peripheral registers including
sahilmgandhi 18:6a4db94011d3 449 * interrupt (NVIC) and optionally DMA. The function can be called multiple
sahilmgandhi 18:6a4db94011d3 450 * times; if the registers are already set it performs no operation and just
sahilmgandhi 18:6a4db94011d3 451 * returns with ARM_DRIVER_OK.
sahilmgandhi 18:6a4db94011d3 452 *
sahilmgandhi 18:6a4db94011d3 453 * To stop working with a peripheral the functions PowerControl and Uninitialize need to be called in this order:
sahilmgandhi 18:6a4db94011d3 454 *
sahilmgandhi 18:6a4db94011d3 455 * drv->PowerControl (ARM_POWER_OFF); // Terminate any pending transfers, reset IRQ/DMA, power off peripheral
sahilmgandhi 18:6a4db94011d3 456 * drv->Uninitialize (...); // Release I/O pins
sahilmgandhi 18:6a4db94011d3 457 *
sahilmgandhi 18:6a4db94011d3 458 * The functions PowerControl and Uninitialize always execute and can be used
sahilmgandhi 18:6a4db94011d3 459 * to put the peripheral into a Safe State, for example after any data
sahilmgandhi 18:6a4db94011d3 460 * transmission errors. To restart the peripheral in an error condition,
sahilmgandhi 18:6a4db94011d3 461 * you should first execute the Stop Sequence and then the Start Sequence.
sahilmgandhi 18:6a4db94011d3 462 *
sahilmgandhi 18:6a4db94011d3 463 * @param state
sahilmgandhi 18:6a4db94011d3 464 * \ref ARM_POWER_STATE. The target power-state for the storage controller.
sahilmgandhi 18:6a4db94011d3 465 * The parameter state can have the following values:
sahilmgandhi 18:6a4db94011d3 466 * - ARM_POWER_FULL : set-up peripheral for data transfers, enable interrupts
sahilmgandhi 18:6a4db94011d3 467 * (NVIC) and optionally DMA. Can be called multiple times. If the peripheral
sahilmgandhi 18:6a4db94011d3 468 * is already in this mode, then the function performs no operation and returns
sahilmgandhi 18:6a4db94011d3 469 * with ARM_DRIVER_OK.
sahilmgandhi 18:6a4db94011d3 470 * - ARM_POWER_LOW : may use power saving. Returns ARM_DRIVER_ERROR_UNSUPPORTED when not implemented.
sahilmgandhi 18:6a4db94011d3 471 * - ARM_POWER_OFF : terminates any pending data transfers, disables peripheral, disables related interrupts and DMA.
sahilmgandhi 18:6a4db94011d3 472 *
sahilmgandhi 18:6a4db94011d3 473 * @note This API may execute asynchronously if
sahilmgandhi 18:6a4db94011d3 474 * ARM_STORAGE_CAPABILITIES::asynchronous_ops is set. Asynchronous
sahilmgandhi 18:6a4db94011d3 475 * execution is optional even if 'asynchronous_ops' is set.
sahilmgandhi 18:6a4db94011d3 476 *
sahilmgandhi 18:6a4db94011d3 477 * @return If asynchronous activity is launched, an invocation returns
sahilmgandhi 18:6a4db94011d3 478 * ARM_DRIVER_OK, and the caller can expect to receive a callback in the
sahilmgandhi 18:6a4db94011d3 479 * future with a status value of ARM_DRIVER_OK or an error-code. In the
sahilmgandhi 18:6a4db94011d3 480 * case of synchronous execution, control returns after completion with a
sahilmgandhi 18:6a4db94011d3 481 * value of 1. Return values less than ARM_DRIVER_OK (0) signify errors.
sahilmgandhi 18:6a4db94011d3 482 */
sahilmgandhi 18:6a4db94011d3 483 int32_t (*PowerControl)(ARM_POWER_STATE state);
sahilmgandhi 18:6a4db94011d3 484
sahilmgandhi 18:6a4db94011d3 485 /**
sahilmgandhi 18:6a4db94011d3 486 * \brief read the contents of a given address range from the storage device.
sahilmgandhi 18:6a4db94011d3 487 *
sahilmgandhi 18:6a4db94011d3 488 * \details Read the contents of a range of storage memory into a buffer
sahilmgandhi 18:6a4db94011d3 489 * supplied by the caller. The buffer is owned by the caller and should
sahilmgandhi 18:6a4db94011d3 490 * remain accessible for the lifetime of this command.
sahilmgandhi 18:6a4db94011d3 491 *
sahilmgandhi 18:6a4db94011d3 492 * @param [in] addr
sahilmgandhi 18:6a4db94011d3 493 * This specifies the address from where to read data.
sahilmgandhi 18:6a4db94011d3 494 *
sahilmgandhi 18:6a4db94011d3 495 * @param [out] data
sahilmgandhi 18:6a4db94011d3 496 * The destination of the read operation. The buffer
sahilmgandhi 18:6a4db94011d3 497 * is owned by the caller and should remain accessible for the
sahilmgandhi 18:6a4db94011d3 498 * lifetime of this command.
sahilmgandhi 18:6a4db94011d3 499 *
sahilmgandhi 18:6a4db94011d3 500 * @param [in] size
sahilmgandhi 18:6a4db94011d3 501 * The number of bytes requested to read. The data buffer
sahilmgandhi 18:6a4db94011d3 502 * should be at least as large as this size.
sahilmgandhi 18:6a4db94011d3 503 *
sahilmgandhi 18:6a4db94011d3 504 * @note This API may execute asynchronously if
sahilmgandhi 18:6a4db94011d3 505 * ARM_STORAGE_CAPABILITIES::asynchronous_ops is set. Asynchronous
sahilmgandhi 18:6a4db94011d3 506 * execution is optional even if 'asynchronous_ops' is set.
sahilmgandhi 18:6a4db94011d3 507 *
sahilmgandhi 18:6a4db94011d3 508 * @return If asynchronous activity is launched, an invocation returns
sahilmgandhi 18:6a4db94011d3 509 * ARM_DRIVER_OK, and the caller can expect to receive a callback in the
sahilmgandhi 18:6a4db94011d3 510 * future with the number of successfully transferred bytes passed in as
sahilmgandhi 18:6a4db94011d3 511 * the 'status' parameter. In the case of synchronous execution, control
sahilmgandhi 18:6a4db94011d3 512 * returns after completion with a positive transfer-count. Return values
sahilmgandhi 18:6a4db94011d3 513 * less than ARM_DRIVER_OK (0) signify errors.
sahilmgandhi 18:6a4db94011d3 514 */
sahilmgandhi 18:6a4db94011d3 515 int32_t (*ReadData)(uint64_t addr, void *data, uint32_t size);
sahilmgandhi 18:6a4db94011d3 516
sahilmgandhi 18:6a4db94011d3 517 /**
sahilmgandhi 18:6a4db94011d3 518 * \brief program (write into) the contents of a given address range of the storage device.
sahilmgandhi 18:6a4db94011d3 519 *
sahilmgandhi 18:6a4db94011d3 520 * \details Write the contents of a given memory buffer into a range of
sahilmgandhi 18:6a4db94011d3 521 * storage memory. In the case of flash memory, the destination range in
sahilmgandhi 18:6a4db94011d3 522 * storage memory typically has its contents in an erased state from a
sahilmgandhi 18:6a4db94011d3 523 * preceding erase operation. The source memory buffer is owned by the
sahilmgandhi 18:6a4db94011d3 524 * caller and should remain accessible for the lifetime of this command.
sahilmgandhi 18:6a4db94011d3 525 *
sahilmgandhi 18:6a4db94011d3 526 * @param [in] addr
sahilmgandhi 18:6a4db94011d3 527 * This is the start address of the range to be written into. It
sahilmgandhi 18:6a4db94011d3 528 * needs to be aligned to the device's \em program_unit
sahilmgandhi 18:6a4db94011d3 529 * specified in \ref ARM_STORAGE_INFO.
sahilmgandhi 18:6a4db94011d3 530 *
sahilmgandhi 18:6a4db94011d3 531 * @param [in] data
sahilmgandhi 18:6a4db94011d3 532 * The source of the write operation. The buffer is owned by the
sahilmgandhi 18:6a4db94011d3 533 * caller and should remain accessible for the lifetime of this
sahilmgandhi 18:6a4db94011d3 534 * command.
sahilmgandhi 18:6a4db94011d3 535 *
sahilmgandhi 18:6a4db94011d3 536 * @param [in] size
sahilmgandhi 18:6a4db94011d3 537 * The number of bytes requested to be written. The buffer
sahilmgandhi 18:6a4db94011d3 538 * should be at least as large as this size. \note 'size' should
sahilmgandhi 18:6a4db94011d3 539 * be a multiple of the device's 'program_unit' (see \ref
sahilmgandhi 18:6a4db94011d3 540 * ARM_STORAGE_INFO).
sahilmgandhi 18:6a4db94011d3 541 *
sahilmgandhi 18:6a4db94011d3 542 * @note It is best for the middleware to write in units of
sahilmgandhi 18:6a4db94011d3 543 * 'optimal_program_unit' (\ref ARM_STORAGE_INFO) of the device.
sahilmgandhi 18:6a4db94011d3 544 *
sahilmgandhi 18:6a4db94011d3 545 * @note This API may execute asynchronously if
sahilmgandhi 18:6a4db94011d3 546 * ARM_STORAGE_CAPABILITIES::asynchronous_ops is set. Asynchronous
sahilmgandhi 18:6a4db94011d3 547 * execution is optional even if 'asynchronous_ops' is set.
sahilmgandhi 18:6a4db94011d3 548 *
sahilmgandhi 18:6a4db94011d3 549 * @return If asynchronous activity is launched, an invocation returns
sahilmgandhi 18:6a4db94011d3 550 * ARM_DRIVER_OK, and the caller can expect to receive a callback in the
sahilmgandhi 18:6a4db94011d3 551 * future with the number of successfully transferred bytes passed in as
sahilmgandhi 18:6a4db94011d3 552 * the 'status' parameter. In the case of synchronous execution, control
sahilmgandhi 18:6a4db94011d3 553 * returns after completion with a positive transfer-count. Return values
sahilmgandhi 18:6a4db94011d3 554 * less than ARM_DRIVER_OK (0) signify errors.
sahilmgandhi 18:6a4db94011d3 555 */
sahilmgandhi 18:6a4db94011d3 556 int32_t (*ProgramData)(uint64_t addr, const void *data, uint32_t size);
sahilmgandhi 18:6a4db94011d3 557
sahilmgandhi 18:6a4db94011d3 558 /**
sahilmgandhi 18:6a4db94011d3 559 * @brief Erase Storage range.
sahilmgandhi 18:6a4db94011d3 560 *
sahilmgandhi 18:6a4db94011d3 561 * @details This function erases a range of storage specified by [addr, addr +
sahilmgandhi 18:6a4db94011d3 562 * size). Both 'addr' and 'addr + size' should align with the
sahilmgandhi 18:6a4db94011d3 563 * 'erase_unit'(s) of the respective owning storage block(s) (see \ref
sahilmgandhi 18:6a4db94011d3 564 * ARM_STORAGE_BLOCK and \ref ARM_STORAGE_BLOCK_ATTRIBUTES). The range to
sahilmgandhi 18:6a4db94011d3 565 * be erased will have its contents returned to the un-programmed state--
sahilmgandhi 18:6a4db94011d3 566 * i.e. to 'erased_value' (see \ref ARM_STORAGE_BLOCK_ATTRIBUTES), which
sahilmgandhi 18:6a4db94011d3 567 * is usually 1 to indicate the pattern of all ones: 0xFF.
sahilmgandhi 18:6a4db94011d3 568 *
sahilmgandhi 18:6a4db94011d3 569 * @param [in] addr
sahilmgandhi 18:6a4db94011d3 570 * This is the start-address of the range to be erased. It must
sahilmgandhi 18:6a4db94011d3 571 * start at an 'erase_unit' boundary of the underlying block.
sahilmgandhi 18:6a4db94011d3 572 *
sahilmgandhi 18:6a4db94011d3 573 * @param [in] size
sahilmgandhi 18:6a4db94011d3 574 * Size (in bytes) of the range to be erased. 'addr + size'
sahilmgandhi 18:6a4db94011d3 575 * must be aligned with the 'erase_unit' of the underlying
sahilmgandhi 18:6a4db94011d3 576 * block.
sahilmgandhi 18:6a4db94011d3 577 *
sahilmgandhi 18:6a4db94011d3 578 * @note This API may execute asynchronously if
sahilmgandhi 18:6a4db94011d3 579 * ARM_STORAGE_CAPABILITIES::asynchronous_ops is set. Asynchronous
sahilmgandhi 18:6a4db94011d3 580 * execution is optional even if 'asynchronous_ops' is set.
sahilmgandhi 18:6a4db94011d3 581 *
sahilmgandhi 18:6a4db94011d3 582 * @return
sahilmgandhi 18:6a4db94011d3 583 * If the range to be erased doesn't align with the erase_units of the
sahilmgandhi 18:6a4db94011d3 584 * respective start and end blocks, ARM_DRIVER_ERROR_PARAMETER is returned.
sahilmgandhi 18:6a4db94011d3 585 * If any part of the range is protected, ARM_STORAGE_ERROR_PROTECTED is
sahilmgandhi 18:6a4db94011d3 586 * returned. If any part of the range is not erasable,
sahilmgandhi 18:6a4db94011d3 587 * ARM_STORAGE_ERROR_NOT_ERASABLE is returned. All such sanity-check
sahilmgandhi 18:6a4db94011d3 588 * failures result in the error code being returned synchronously and the
sahilmgandhi 18:6a4db94011d3 589 * storage bytes within the range remain unaffected.
sahilmgandhi 18:6a4db94011d3 590 * Otherwise the function executes in the following ways:
sahilmgandhi 18:6a4db94011d3 591 * If asynchronous activity is launched, an invocation returns
sahilmgandhi 18:6a4db94011d3 592 * ARM_DRIVER_OK, and the caller can expect to receive a callback in the
sahilmgandhi 18:6a4db94011d3 593 * future with the number of successfully erased bytes passed in as
sahilmgandhi 18:6a4db94011d3 594 * the 'status' parameter. In the case of synchronous execution, control
sahilmgandhi 18:6a4db94011d3 595 * returns after completion with a positive erase-count. Return values
sahilmgandhi 18:6a4db94011d3 596 * less than ARM_DRIVER_OK (0) signify errors.
sahilmgandhi 18:6a4db94011d3 597 *
sahilmgandhi 18:6a4db94011d3 598 * @note Erase() may return a smaller (positive) value than the size of the
sahilmgandhi 18:6a4db94011d3 599 * requested range. The returned value indicates the actual number of bytes
sahilmgandhi 18:6a4db94011d3 600 * erased. It is the caller's responsibility to follow up with an appropriate
sahilmgandhi 18:6a4db94011d3 601 * request to complete the operation.
sahilmgandhi 18:6a4db94011d3 602 *
sahilmgandhi 18:6a4db94011d3 603 * @note in the case of a failed erase (except when
sahilmgandhi 18:6a4db94011d3 604 * ARM_DRIVER_ERROR_PARAMETER, ARM_STORAGE_ERROR_PROTECTED, or
sahilmgandhi 18:6a4db94011d3 605 * ARM_STORAGE_ERROR_NOT_ERASABLE is returned synchronously), the
sahilmgandhi 18:6a4db94011d3 606 * requested range should be assumed to be in an unknown state. The
sahilmgandhi 18:6a4db94011d3 607 * previous contents may not be retained.
sahilmgandhi 18:6a4db94011d3 608 */
sahilmgandhi 18:6a4db94011d3 609 int32_t (*Erase)(uint64_t addr, uint32_t size);
sahilmgandhi 18:6a4db94011d3 610
sahilmgandhi 18:6a4db94011d3 611 /**
sahilmgandhi 18:6a4db94011d3 612 * @brief Erase complete storage. Optional function for faster erase of the complete device.
sahilmgandhi 18:6a4db94011d3 613 *
sahilmgandhi 18:6a4db94011d3 614 * This optional function erases the complete device. If the device does not
sahilmgandhi 18:6a4db94011d3 615 * support global erase then the function returns the error value \ref
sahilmgandhi 18:6a4db94011d3 616 * ARM_DRIVER_ERROR_UNSUPPORTED. The data field \em 'erase_all' =
sahilmgandhi 18:6a4db94011d3 617 * \token{1} of the structure \ref ARM_STORAGE_CAPABILITIES encodes that
sahilmgandhi 18:6a4db94011d3 618 * \ref ARM_STORAGE_EraseAll is supported.
sahilmgandhi 18:6a4db94011d3 619 *
sahilmgandhi 18:6a4db94011d3 620 * @note This API may execute asynchronously if
sahilmgandhi 18:6a4db94011d3 621 * ARM_STORAGE_CAPABILITIES::asynchronous_ops is set. Asynchronous
sahilmgandhi 18:6a4db94011d3 622 * execution is optional even if 'asynchronous_ops' is set.
sahilmgandhi 18:6a4db94011d3 623 *
sahilmgandhi 18:6a4db94011d3 624 * @return
sahilmgandhi 18:6a4db94011d3 625 * If any part of the storage range is protected,
sahilmgandhi 18:6a4db94011d3 626 * ARM_STORAGE_ERROR_PROTECTED is returned. If any part of the storage
sahilmgandhi 18:6a4db94011d3 627 * range is not erasable, ARM_STORAGE_ERROR_NOT_ERASABLE is returned. All
sahilmgandhi 18:6a4db94011d3 628 * such sanity-check failures result in the error code being returned
sahilmgandhi 18:6a4db94011d3 629 * synchronously and the storage bytes within the range remain unaffected.
sahilmgandhi 18:6a4db94011d3 630 * Otherwise the function executes in the following ways:
sahilmgandhi 18:6a4db94011d3 631 * If asynchronous activity is launched, an invocation returns
sahilmgandhi 18:6a4db94011d3 632 * ARM_DRIVER_OK, and the caller can expect to receive a callback in the
sahilmgandhi 18:6a4db94011d3 633 * future with ARM_DRIVER_OK passed in as the 'status' parameter. In the
sahilmgandhi 18:6a4db94011d3 634 * case of synchronous execution, control returns after completion with a
sahilmgandhi 18:6a4db94011d3 635 * value of 1. Return values less than ARM_DRIVER_OK (0) signify errors.
sahilmgandhi 18:6a4db94011d3 636 */
sahilmgandhi 18:6a4db94011d3 637 int32_t (*EraseAll)(void);
sahilmgandhi 18:6a4db94011d3 638
sahilmgandhi 18:6a4db94011d3 639 /**
sahilmgandhi 18:6a4db94011d3 640 * @brief Get the status of the current (or previous) command executed by the
sahilmgandhi 18:6a4db94011d3 641 * storage controller; stored in the structure \ref ARM_STORAGE_STATUS.
sahilmgandhi 18:6a4db94011d3 642 *
sahilmgandhi 18:6a4db94011d3 643 * @return
sahilmgandhi 18:6a4db94011d3 644 * The status of the underlying controller.
sahilmgandhi 18:6a4db94011d3 645 *
sahilmgandhi 18:6a4db94011d3 646 * @note This API returns synchronously--it does not result in an invocation
sahilmgandhi 18:6a4db94011d3 647 * of a completion callback.
sahilmgandhi 18:6a4db94011d3 648 */
sahilmgandhi 18:6a4db94011d3 649 ARM_STORAGE_STATUS (*GetStatus)(void);
sahilmgandhi 18:6a4db94011d3 650
sahilmgandhi 18:6a4db94011d3 651 /**
sahilmgandhi 18:6a4db94011d3 652 * @brief Get information about the Storage device; stored in the structure \ref ARM_STORAGE_INFO.
sahilmgandhi 18:6a4db94011d3 653 *
sahilmgandhi 18:6a4db94011d3 654 * @param [out] info
sahilmgandhi 18:6a4db94011d3 655 * A caller-supplied buffer capable of being filled in with an
sahilmgandhi 18:6a4db94011d3 656 * \ref ARM_STORAGE_INFO.
sahilmgandhi 18:6a4db94011d3 657 *
sahilmgandhi 18:6a4db94011d3 658 * @return ARM_DRIVER_OK if a ARM_STORAGE_INFO structure containing top level
sahilmgandhi 18:6a4db94011d3 659 * metadata about the storage controller is filled into the supplied
sahilmgandhi 18:6a4db94011d3 660 * buffer, else an appropriate error value.
sahilmgandhi 18:6a4db94011d3 661 *
sahilmgandhi 18:6a4db94011d3 662 * @note It is the caller's responsibility to ensure that the buffer passed in
sahilmgandhi 18:6a4db94011d3 663 * is able to be initialized with a \ref ARM_STORAGE_INFO.
sahilmgandhi 18:6a4db94011d3 664 *
sahilmgandhi 18:6a4db94011d3 665 * @note This API returns synchronously--it does not result in an invocation
sahilmgandhi 18:6a4db94011d3 666 * of a completion callback.
sahilmgandhi 18:6a4db94011d3 667 */
sahilmgandhi 18:6a4db94011d3 668 int32_t (*GetInfo)(ARM_STORAGE_INFO *info);
sahilmgandhi 18:6a4db94011d3 669
sahilmgandhi 18:6a4db94011d3 670 /**
sahilmgandhi 18:6a4db94011d3 671 * \brief For memory-mapped storage, resolve an address relative to
sahilmgandhi 18:6a4db94011d3 672 * the storage controller into a memory address.
sahilmgandhi 18:6a4db94011d3 673 *
sahilmgandhi 18:6a4db94011d3 674 * @param addr
sahilmgandhi 18:6a4db94011d3 675 * This is the address for which we want a resolution to the
sahilmgandhi 18:6a4db94011d3 676 * processor's physical address space. It is an offset from the
sahilmgandhi 18:6a4db94011d3 677 * start of the storage map maintained by the owning storage
sahilmgandhi 18:6a4db94011d3 678 * controller.
sahilmgandhi 18:6a4db94011d3 679 *
sahilmgandhi 18:6a4db94011d3 680 * @return
sahilmgandhi 18:6a4db94011d3 681 * The resolved address in the processor's address space; else
sahilmgandhi 18:6a4db94011d3 682 * ARM_STORAGE_INVALID_ADDRESS, if no resolution is possible.
sahilmgandhi 18:6a4db94011d3 683 *
sahilmgandhi 18:6a4db94011d3 684 * @note This API returns synchronously. The invocation should return quickly,
sahilmgandhi 18:6a4db94011d3 685 * and result in a resolved address.
sahilmgandhi 18:6a4db94011d3 686 */
sahilmgandhi 18:6a4db94011d3 687 uint32_t (*ResolveAddress)(uint64_t addr);
sahilmgandhi 18:6a4db94011d3 688
sahilmgandhi 18:6a4db94011d3 689 /**
sahilmgandhi 18:6a4db94011d3 690 * @brief Advance to the successor of the current block (iterator), or fetch
sahilmgandhi 18:6a4db94011d3 691 * the first block (if 'prev_block' is passed in as NULL).
sahilmgandhi 18:6a4db94011d3 692 *
sahilmgandhi 18:6a4db94011d3 693 * @details This helper function fetches (an iterator to) the next block (or
sahilmgandhi 18:6a4db94011d3 694 * the first block if 'prev_block' is passed in as NULL). In the failure
sahilmgandhi 18:6a4db94011d3 695 * case, a terminating, invalid block iterator is filled into the out
sahilmgandhi 18:6a4db94011d3 696 * parameter: 'next_block'. In combination with \ref
sahilmgandhi 18:6a4db94011d3 697 * ARM_STORAGE_VALID_BLOCK(), it can be used to iterate over the sequence
sahilmgandhi 18:6a4db94011d3 698 * of blocks within the storage map:
sahilmgandhi 18:6a4db94011d3 699 *
sahilmgandhi 18:6a4db94011d3 700 * \code
sahilmgandhi 18:6a4db94011d3 701 * ARM_STORAGE_BLOCK block;
sahilmgandhi 18:6a4db94011d3 702 * for (drv->GetNextBlock(NULL, &block); ARM_STORAGE_VALID_BLOCK(&block); drv->GetNextBlock(&block, &block)) {
sahilmgandhi 18:6a4db94011d3 703 * // make use of block
sahilmgandhi 18:6a4db94011d3 704 * }
sahilmgandhi 18:6a4db94011d3 705 * \endcode
sahilmgandhi 18:6a4db94011d3 706 *
sahilmgandhi 18:6a4db94011d3 707 * @param[in] prev_block
sahilmgandhi 18:6a4db94011d3 708 * An existing block (iterator) within the same storage
sahilmgandhi 18:6a4db94011d3 709 * controller. The memory buffer holding this block is owned
sahilmgandhi 18:6a4db94011d3 710 * by the caller. This pointer may be NULL; if so, the
sahilmgandhi 18:6a4db94011d3 711 * invocation fills in the first block into the out parameter:
sahilmgandhi 18:6a4db94011d3 712 * 'next_block'.
sahilmgandhi 18:6a4db94011d3 713 *
sahilmgandhi 18:6a4db94011d3 714 * @param[out] next_block
sahilmgandhi 18:6a4db94011d3 715 * A caller-owned buffer large enough to be filled in with
sahilmgandhi 18:6a4db94011d3 716 * the following ARM_STORAGE_BLOCK. It is legal to provide the
sahilmgandhi 18:6a4db94011d3 717 * same buffer using 'next_block' as was passed in with 'prev_block'. It
sahilmgandhi 18:6a4db94011d3 718 * is also legal to pass a NULL into this parameter if the
sahilmgandhi 18:6a4db94011d3 719 * caller isn't interested in populating a buffer with the next
sahilmgandhi 18:6a4db94011d3 720 * block--i.e. if the caller only wishes to establish the
sahilmgandhi 18:6a4db94011d3 721 * presence of a next block.
sahilmgandhi 18:6a4db94011d3 722 *
sahilmgandhi 18:6a4db94011d3 723 * @return ARM_DRIVER_OK if a valid next block is found (or first block, if
sahilmgandhi 18:6a4db94011d3 724 * prev_block is passed as NULL); upon successful operation, the contents
sahilmgandhi 18:6a4db94011d3 725 * of the next (or first) block are filled into the buffer pointed to by
sahilmgandhi 18:6a4db94011d3 726 * the parameter 'next_block' and ARM_STORAGE_VALID_BLOCK(next_block) is
sahilmgandhi 18:6a4db94011d3 727 * guaranteed to be true. Upon reaching the end of the sequence of blocks
sahilmgandhi 18:6a4db94011d3 728 * (iterators), or in case the driver is unable to fetch information about
sahilmgandhi 18:6a4db94011d3 729 * the next (or first) block, an error (negative) value is returned and an
sahilmgandhi 18:6a4db94011d3 730 * invalid StorageBlock is populated into the supplied buffer. If
sahilmgandhi 18:6a4db94011d3 731 * prev_block is NULL, the first block is returned.
sahilmgandhi 18:6a4db94011d3 732 *
sahilmgandhi 18:6a4db94011d3 733 * @note This API returns synchronously--it does not result in an invocation
sahilmgandhi 18:6a4db94011d3 734 * of a completion callback.
sahilmgandhi 18:6a4db94011d3 735 */
sahilmgandhi 18:6a4db94011d3 736 int32_t (*GetNextBlock)(const ARM_STORAGE_BLOCK* prev_block, ARM_STORAGE_BLOCK *next_block);
sahilmgandhi 18:6a4db94011d3 737
sahilmgandhi 18:6a4db94011d3 738 /**
sahilmgandhi 18:6a4db94011d3 739 * @brief Find the storage block (iterator) encompassing a given storage address.
sahilmgandhi 18:6a4db94011d3 740 *
sahilmgandhi 18:6a4db94011d3 741 * @param[in] addr
sahilmgandhi 18:6a4db94011d3 742 * Storage address in bytes.
sahilmgandhi 18:6a4db94011d3 743 *
sahilmgandhi 18:6a4db94011d3 744 * @param[out] block
sahilmgandhi 18:6a4db94011d3 745 * A caller-owned buffer large enough to be filled in with the
sahilmgandhi 18:6a4db94011d3 746 * ARM_STORAGE_BLOCK encapsulating the given address. This value
sahilmgandhi 18:6a4db94011d3 747 * can also be passed in as NULL if the caller isn't interested
sahilmgandhi 18:6a4db94011d3 748 * in populating a buffer with the block--if the caller only
sahilmgandhi 18:6a4db94011d3 749 * wishes to establish the presence of a containing storage
sahilmgandhi 18:6a4db94011d3 750 * block.
sahilmgandhi 18:6a4db94011d3 751 *
sahilmgandhi 18:6a4db94011d3 752 * @return ARM_DRIVER_OK if a containing storage-block is found. In this case,
sahilmgandhi 18:6a4db94011d3 753 * if block is non-NULL, the buffer pointed to by it is populated with
sahilmgandhi 18:6a4db94011d3 754 * the contents of the storage block--i.e. if block is valid and a block is
sahilmgandhi 18:6a4db94011d3 755 * found, ARM_STORAGE_VALID_BLOCK(block) would return true following this
sahilmgandhi 18:6a4db94011d3 756 * call. If there is no storage block containing the given offset, or in
sahilmgandhi 18:6a4db94011d3 757 * case the driver is unable to resolve an address to a storage-block, an
sahilmgandhi 18:6a4db94011d3 758 * error (negative) value is returned and an invalid StorageBlock is
sahilmgandhi 18:6a4db94011d3 759 * populated into the supplied buffer.
sahilmgandhi 18:6a4db94011d3 760 *
sahilmgandhi 18:6a4db94011d3 761 * @note This API returns synchronously--it does not result in an invocation
sahilmgandhi 18:6a4db94011d3 762 * of a completion callback.
sahilmgandhi 18:6a4db94011d3 763 */
sahilmgandhi 18:6a4db94011d3 764 int32_t (*GetBlock)(uint64_t addr, ARM_STORAGE_BLOCK *block);
sahilmgandhi 18:6a4db94011d3 765 } const ARM_DRIVER_STORAGE;
sahilmgandhi 18:6a4db94011d3 766
sahilmgandhi 18:6a4db94011d3 767 #ifdef __cplusplus
sahilmgandhi 18:6a4db94011d3 768 }
sahilmgandhi 18:6a4db94011d3 769 #endif // __cplusplus
sahilmgandhi 18:6a4db94011d3 770
sahilmgandhi 18:6a4db94011d3 771 #endif /* __DRIVER_STORAGE_H */
sahilmgandhi 18:6a4db94011d3 772
sahilmgandhi 18:6a4db94011d3 773 /** @}*/