SDCard version

Fork of gr-peach-opencv-project-sd-card by the do

Committer:
thedo
Date:
Fri Jul 21 01:26:54 2017 +0000
Revision:
167:2ee3e82cb6f5
gr-peach-opencv-project-sd-card

Who changed what in which revision?

UserRevisionLine numberNew contents of line
thedo 167:2ee3e82cb6f5 1 /** \addtogroup hal */
thedo 167:2ee3e82cb6f5 2 /** @{*/
thedo 167:2ee3e82cb6f5 3
thedo 167:2ee3e82cb6f5 4 /* mbed Microcontroller Library
thedo 167:2ee3e82cb6f5 5 * Copyright (c) 2017 ARM Limited
thedo 167:2ee3e82cb6f5 6 *
thedo 167:2ee3e82cb6f5 7 * Licensed under the Apache License, Version 2.0 (the "License");
thedo 167:2ee3e82cb6f5 8 * you may not use this file except in compliance with the License.
thedo 167:2ee3e82cb6f5 9 * You may obtain a copy of the License at
thedo 167:2ee3e82cb6f5 10 *
thedo 167:2ee3e82cb6f5 11 * http://www.apache.org/licenses/LICENSE-2.0
thedo 167:2ee3e82cb6f5 12 *
thedo 167:2ee3e82cb6f5 13 * Unless required by applicable law or agreed to in writing, software
thedo 167:2ee3e82cb6f5 14 * distributed under the License is distributed on an "AS IS" BASIS,
thedo 167:2ee3e82cb6f5 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
thedo 167:2ee3e82cb6f5 16 * See the License for the specific language governing permissions and
thedo 167:2ee3e82cb6f5 17 * limitations under the License.
thedo 167:2ee3e82cb6f5 18 */
thedo 167:2ee3e82cb6f5 19 #ifndef MBED_FLASH_API_H
thedo 167:2ee3e82cb6f5 20 #define MBED_FLASH_API_H
thedo 167:2ee3e82cb6f5 21
thedo 167:2ee3e82cb6f5 22 #include "device.h"
thedo 167:2ee3e82cb6f5 23 #include <stdint.h>
thedo 167:2ee3e82cb6f5 24
thedo 167:2ee3e82cb6f5 25 #if DEVICE_FLASH
thedo 167:2ee3e82cb6f5 26
thedo 167:2ee3e82cb6f5 27 #define MBED_FLASH_INVALID_SIZE 0xFFFFFFFF
thedo 167:2ee3e82cb6f5 28
thedo 167:2ee3e82cb6f5 29 typedef struct flash_s flash_t;
thedo 167:2ee3e82cb6f5 30
thedo 167:2ee3e82cb6f5 31 #if TARGET_FLASH_CMSIS_ALGO
thedo 167:2ee3e82cb6f5 32 #include "flash_data.h"
thedo 167:2ee3e82cb6f5 33 #endif
thedo 167:2ee3e82cb6f5 34
thedo 167:2ee3e82cb6f5 35 #ifdef __cplusplus
thedo 167:2ee3e82cb6f5 36 extern "C" {
thedo 167:2ee3e82cb6f5 37 #endif
thedo 167:2ee3e82cb6f5 38
thedo 167:2ee3e82cb6f5 39 /**
thedo 167:2ee3e82cb6f5 40 * \defgroup flash_hal Flash HAL API
thedo 167:2ee3e82cb6f5 41 * @{
thedo 167:2ee3e82cb6f5 42 */
thedo 167:2ee3e82cb6f5 43
thedo 167:2ee3e82cb6f5 44 /** Initialize the flash peripheral and the flash_t object
thedo 167:2ee3e82cb6f5 45 *
thedo 167:2ee3e82cb6f5 46 * @param obj The flash object
thedo 167:2ee3e82cb6f5 47 * @return 0 for success, -1 for error
thedo 167:2ee3e82cb6f5 48 */
thedo 167:2ee3e82cb6f5 49 int32_t flash_init(flash_t *obj);
thedo 167:2ee3e82cb6f5 50
thedo 167:2ee3e82cb6f5 51 /** Uninitialize the flash peripheral and the flash_t object
thedo 167:2ee3e82cb6f5 52 *
thedo 167:2ee3e82cb6f5 53 * @param obj The flash object
thedo 167:2ee3e82cb6f5 54 * @return 0 for success, -1 for error
thedo 167:2ee3e82cb6f5 55 */
thedo 167:2ee3e82cb6f5 56 int32_t flash_free(flash_t *obj);
thedo 167:2ee3e82cb6f5 57
thedo 167:2ee3e82cb6f5 58 /** Erase one sector starting at defined address
thedo 167:2ee3e82cb6f5 59 *
thedo 167:2ee3e82cb6f5 60 * The address should be at sector boundary. This function does not do any check for address alignments
thedo 167:2ee3e82cb6f5 61 * @param obj The flash object
thedo 167:2ee3e82cb6f5 62 * @param address The sector starting address
thedo 167:2ee3e82cb6f5 63 * @return 0 for success, -1 for error
thedo 167:2ee3e82cb6f5 64 */
thedo 167:2ee3e82cb6f5 65 int32_t flash_erase_sector(flash_t *obj, uint32_t address);
thedo 167:2ee3e82cb6f5 66
thedo 167:2ee3e82cb6f5 67 /** Program one page starting at defined address
thedo 167:2ee3e82cb6f5 68 *
thedo 167:2ee3e82cb6f5 69 * The page should be at page boundary, should not cross multiple sectors.
thedo 167:2ee3e82cb6f5 70 * This function does not do any check for address alignments or if size is aligned to a page size.
thedo 167:2ee3e82cb6f5 71 * @param obj The flash object
thedo 167:2ee3e82cb6f5 72 * @param address The sector starting address
thedo 167:2ee3e82cb6f5 73 * @param data The data buffer to be programmed
thedo 167:2ee3e82cb6f5 74 * @param size The number of bytes to program
thedo 167:2ee3e82cb6f5 75 * @return 0 for success, -1 for error
thedo 167:2ee3e82cb6f5 76 */
thedo 167:2ee3e82cb6f5 77 int32_t flash_program_page(flash_t *obj, uint32_t address, const uint8_t *data, uint32_t size);
thedo 167:2ee3e82cb6f5 78
thedo 167:2ee3e82cb6f5 79 /** Get sector size
thedo 167:2ee3e82cb6f5 80 *
thedo 167:2ee3e82cb6f5 81 * @param obj The flash object
thedo 167:2ee3e82cb6f5 82 * @param address The sector starting address
thedo 167:2ee3e82cb6f5 83 * @return The size of a sector
thedo 167:2ee3e82cb6f5 84 */
thedo 167:2ee3e82cb6f5 85 uint32_t flash_get_sector_size(const flash_t *obj, uint32_t address);
thedo 167:2ee3e82cb6f5 86
thedo 167:2ee3e82cb6f5 87 /** Get page size
thedo 167:2ee3e82cb6f5 88 *
thedo 167:2ee3e82cb6f5 89 * @param obj The flash object
thedo 167:2ee3e82cb6f5 90 * @param address The page starting address
thedo 167:2ee3e82cb6f5 91 * @return The size of a page
thedo 167:2ee3e82cb6f5 92 */
thedo 167:2ee3e82cb6f5 93 uint32_t flash_get_page_size(const flash_t *obj);
thedo 167:2ee3e82cb6f5 94
thedo 167:2ee3e82cb6f5 95 /** Get start address for the flash region
thedo 167:2ee3e82cb6f5 96 *
thedo 167:2ee3e82cb6f5 97 * @param obj The flash object
thedo 167:2ee3e82cb6f5 98 * @return The start address for the flash region
thedo 167:2ee3e82cb6f5 99 */
thedo 167:2ee3e82cb6f5 100 uint32_t flash_get_start_address(const flash_t *obj);
thedo 167:2ee3e82cb6f5 101
thedo 167:2ee3e82cb6f5 102 /** Get the flash region size
thedo 167:2ee3e82cb6f5 103 *
thedo 167:2ee3e82cb6f5 104 * @param obj The flash object
thedo 167:2ee3e82cb6f5 105 * @return The flash region size
thedo 167:2ee3e82cb6f5 106 */
thedo 167:2ee3e82cb6f5 107 uint32_t flash_get_size(const flash_t *obj);
thedo 167:2ee3e82cb6f5 108
thedo 167:2ee3e82cb6f5 109 /**@}*/
thedo 167:2ee3e82cb6f5 110
thedo 167:2ee3e82cb6f5 111 #ifdef __cplusplus
thedo 167:2ee3e82cb6f5 112 }
thedo 167:2ee3e82cb6f5 113 #endif
thedo 167:2ee3e82cb6f5 114
thedo 167:2ee3e82cb6f5 115 #endif
thedo 167:2ee3e82cb6f5 116
thedo 167:2ee3e82cb6f5 117 #endif
thedo 167:2ee3e82cb6f5 118
thedo 167:2ee3e82cb6f5 119 /** @}*/
thedo 167:2ee3e82cb6f5 120