mbed HRM11017を使ってkonashi.jsでナイトライダー

Dependencies:   BLE_API_Native_IRC mbed

Fork of BLE_RCBController by Junichi Katsu

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers pstorage_platform.h Source File

pstorage_platform.h

00001 /* Copyright (c)  2013 Nordic Semiconductor. All Rights Reserved.
00002  *
00003  * The information contained herein is property of Nordic Semiconductor ASA.
00004  * Terms and conditions of usage are described in detail in NORDIC
00005  * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
00006  *
00007  * Licensees are granted free, non-transferable use of the information. NO
00008  * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
00009  * the file.
00010  *
00011  */
00012 
00013  /** @cond To make doxygen skip this file */
00014 
00015 /** @file
00016  *  This header contains defines with respect persistent storage that are specific to
00017  *  persistent storage implementation and application use case.
00018  */
00019 #ifndef PSTORAGE_PL_H__
00020 #define PSTORAGE_PL_H__
00021 
00022 #include <stdint.h>
00023 #include "nordic_global.h"
00024 
00025 #define PSTORAGE_FLASH_PAGE_SIZE    ((uint16_t)NRF_FICR->CODEPAGESIZE)   /**< Size of one flash page. */
00026 #define PSTORAGE_FLASH_EMPTY_MASK    0xFFFFFFFF                          /**< Bit mask that defines an empty address in flash. */
00027 
00028 #define PSTORAGE_FLASH_PAGE_END                                     \
00029         ((NRF_UICR->BOOTLOADERADDR != PSTORAGE_FLASH_EMPTY_MASK)    \
00030         ? (NRF_UICR->BOOTLOADERADDR / PSTORAGE_FLASH_PAGE_SIZE)     \
00031         : NRF_FICR->CODESIZE)
00032 
00033 
00034 #define PSTORAGE_MAX_APPLICATIONS   2                                                           /**< Maximum number of applications that can be registered with the module, configurable based on system requirements. */
00035 #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. */
00036 
00037 #define PSTORAGE_DATA_START_ADDR    ((PSTORAGE_FLASH_PAGE_END - PSTORAGE_MAX_APPLICATIONS) \
00038                                     * PSTORAGE_FLASH_PAGE_SIZE)                                 /**< Start address for persistent data, configurable according to system requirements. */
00039 #define PSTORAGE_DATA_END_ADDR      (PSTORAGE_FLASH_PAGE_END * PSTORAGE_FLASH_PAGE_SIZE)        /**< End address for persistent data, configurable according to system requirements. */
00040 
00041 #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. */
00042 #define PSTORAGE_CMD_QUEUE_SIZE     30                                                          /**< Maximum number of flash access commands that can be maintained by the module for all applications. Configurable. */
00043 
00044 
00045 /** Abstracts persistently memory block identifier. */
00046 typedef uint32_t pstorage_block_t;
00047 
00048 typedef struct
00049 {
00050     uint32_t            module_id;      /**< Module ID.*/
00051     pstorage_block_t    block_id;       /**< Block ID.*/
00052 } pstorage_handle_t;
00053 
00054 typedef uint16_t pstorage_size_t;      /** Size of length and offset fields. */
00055 
00056 /**@brief Handles Flash Access Result Events. To be called in the system event dispatcher of the application. */
00057 void pstorage_sys_event_handler (uint32_t sys_evt);
00058 
00059 #endif // PSTORAGE_PL_H__
00060 
00061 /** @} */
00062 /** @endcond */