Openwear requires RC oscillator to be used

Fork of nRF51822 by Nordic Semiconductor

Committer:
janekm
Date:
Thu Sep 04 21:18:28 2014 +0000
Revision:
62:4dfe75dd5769
Parent:
45:3c4df37ed83e
?

Who changed what in which revision?

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