テスト用です。

Dependencies:   mbed

Committer:
jksoft
Date:
Tue Oct 11 11:09:42 2016 +0000
Revision:
0:8468a4403fea
SB??ver;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jksoft 0:8468a4403fea 1 /* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved.
jksoft 0:8468a4403fea 2 *
jksoft 0:8468a4403fea 3 * The information contained herein is property of Nordic Semiconductor ASA.
jksoft 0:8468a4403fea 4 * Terms and conditions of usage are described in detail in NORDIC
jksoft 0:8468a4403fea 5 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
jksoft 0:8468a4403fea 6 *
jksoft 0:8468a4403fea 7 * Licensees are granted free, non-transferable use of the information. NO
jksoft 0:8468a4403fea 8 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
jksoft 0:8468a4403fea 9 * the file.
jksoft 0:8468a4403fea 10 *
jksoft 0:8468a4403fea 11 */
jksoft 0:8468a4403fea 12
jksoft 0:8468a4403fea 13 /** @cond To make doxygen skip this file */
jksoft 0:8468a4403fea 14
jksoft 0:8468a4403fea 15 /** @file
jksoft 0:8468a4403fea 16 * This header contains defines with respect persistent storage that are specific to
jksoft 0:8468a4403fea 17 * persistent storage implementation and application use case.
jksoft 0:8468a4403fea 18 */
jksoft 0:8468a4403fea 19 #ifndef PSTORAGE_PL_H__
jksoft 0:8468a4403fea 20 #define PSTORAGE_PL_H__
jksoft 0:8468a4403fea 21
jksoft 0:8468a4403fea 22 #include <stdint.h>
jksoft 0:8468a4403fea 23 #include "nordic_global.h"
jksoft 0:8468a4403fea 24
jksoft 0:8468a4403fea 25 #ifdef __cplusplus
jksoft 0:8468a4403fea 26 extern "C" {
jksoft 0:8468a4403fea 27 #endif // #ifdef __cplusplus
jksoft 0:8468a4403fea 28
jksoft 0:8468a4403fea 29 #define PSTORAGE_FLASH_PAGE_SIZE ((uint16_t)NRF_FICR->CODEPAGESIZE) /**< Size of one flash page. */
jksoft 0:8468a4403fea 30 #define PSTORAGE_FLASH_EMPTY_MASK 0xFFFFFFFF /**< Bit mask that defines an empty address in flash. */
jksoft 0:8468a4403fea 31
jksoft 0:8468a4403fea 32 #define PSTORAGE_FLASH_PAGE_END \
jksoft 0:8468a4403fea 33 ((NRF_UICR->BOOTLOADERADDR != PSTORAGE_FLASH_EMPTY_MASK) \
jksoft 0:8468a4403fea 34 ? (NRF_UICR->BOOTLOADERADDR / PSTORAGE_FLASH_PAGE_SIZE) \
jksoft 0:8468a4403fea 35 : NRF_FICR->CODESIZE)
jksoft 0:8468a4403fea 36
jksoft 0:8468a4403fea 37
jksoft 0:8468a4403fea 38 #define PSTORAGE_MAX_APPLICATIONS 2 /**< Maximum number of applications that can be registered with the module, configurable based on system requirements. */
jksoft 0:8468a4403fea 39 #define PSTORAGE_MIN_BLOCK_SIZE 0x0010 /**< Minimum size of block that can be registered with the module. Should be configured based on system requirements, recommendation is not have this value to be at least size of word. */
jksoft 0:8468a4403fea 40
jksoft 0:8468a4403fea 41 #define PSTORAGE_DATA_START_ADDR ((PSTORAGE_FLASH_PAGE_END - PSTORAGE_MAX_APPLICATIONS) \
jksoft 0:8468a4403fea 42 * PSTORAGE_FLASH_PAGE_SIZE) /**< Start address for persistent data, configurable according to system requirements. */
jksoft 0:8468a4403fea 43 #define PSTORAGE_DATA_END_ADDR (PSTORAGE_FLASH_PAGE_END * PSTORAGE_FLASH_PAGE_SIZE) /**< End address for persistent data, configurable according to system requirements. */
jksoft 0:8468a4403fea 44
jksoft 0:8468a4403fea 45 #define PSTORAGE_MAX_BLOCK_SIZE PSTORAGE_FLASH_PAGE_SIZE /**< Maximum size of block that can be registered with the module. Should be configured based on system requirements. And should be greater than or equal to the minimum size. */
jksoft 0:8468a4403fea 46 #define PSTORAGE_CMD_QUEUE_SIZE 30 /**< Maximum number of flash access commands that can be maintained by the module for all applications. Configurable. */
jksoft 0:8468a4403fea 47
jksoft 0:8468a4403fea 48
jksoft 0:8468a4403fea 49 /** Abstracts persistently memory block identifier. */
jksoft 0:8468a4403fea 50 typedef uint32_t pstorage_block_t;
jksoft 0:8468a4403fea 51
jksoft 0:8468a4403fea 52 typedef struct
jksoft 0:8468a4403fea 53 {
jksoft 0:8468a4403fea 54 uint32_t module_id; /**< Module ID.*/
jksoft 0:8468a4403fea 55 pstorage_block_t block_id; /**< Block ID.*/
jksoft 0:8468a4403fea 56 } pstorage_handle_t;
jksoft 0:8468a4403fea 57
jksoft 0:8468a4403fea 58 typedef uint16_t pstorage_size_t; /** Size of length and offset fields. */
jksoft 0:8468a4403fea 59
jksoft 0:8468a4403fea 60 /**@brief Handles Flash Access Result Events. To be called in the system event dispatcher of the application. */
jksoft 0:8468a4403fea 61 void pstorage_sys_event_handler (uint32_t sys_evt);
jksoft 0:8468a4403fea 62
jksoft 0:8468a4403fea 63 #ifdef __cplusplus
jksoft 0:8468a4403fea 64 }
jksoft 0:8468a4403fea 65 #endif // #ifdef __cplusplus
jksoft 0:8468a4403fea 66
jksoft 0:8468a4403fea 67 #endif // PSTORAGE_PL_H__
jksoft 0:8468a4403fea 68
jksoft 0:8468a4403fea 69 /** @} */
jksoft 0:8468a4403fea 70 /** @endcond */