Openwear requires RC oscillator to be used

Fork of nRF51822 by Nordic Semiconductor

Committer:
bogdanm
Date:
Wed Mar 26 14:38:17 2014 +0000
Revision:
0:eff01767de02
Child:
45:3c4df37ed83e
Initial import of the nRF51822 code

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
bogdanm 0:eff01767de02 25 #define PSTORAGE_FLASH_PAGE_SIZE ((uint16_t)NRF_FICR->CODEPAGESIZE) /**< Size of one flash page. */
bogdanm 0:eff01767de02 26 #define PSTORAGE_FLASH_EMPTY_MASK 0xFFFFFFFF /**< Bit mask that defines an empty address in flash. */
bogdanm 0:eff01767de02 27
bogdanm 0:eff01767de02 28 #define PSTORAGE_FLASH_PAGE_END \
bogdanm 0:eff01767de02 29 ((NRF_UICR->BOOTLOADERADDR != PSTORAGE_FLASH_EMPTY_MASK) \
bogdanm 0:eff01767de02 30 ? (NRF_UICR->BOOTLOADERADDR / PSTORAGE_FLASH_PAGE_SIZE) \
bogdanm 0:eff01767de02 31 : NRF_FICR->CODESIZE)
bogdanm 0:eff01767de02 32
bogdanm 0:eff01767de02 33
bogdanm 0:eff01767de02 34 #define PSTORAGE_MAX_APPLICATIONS 2 /**< Maximum number of applications that can be registered with the module, configurable based on system requirements. */
bogdanm 0:eff01767de02 35 #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 36
bogdanm 0:eff01767de02 37 #define PSTORAGE_DATA_START_ADDR ((PSTORAGE_FLASH_PAGE_END - PSTORAGE_MAX_APPLICATIONS) \
bogdanm 0:eff01767de02 38 * PSTORAGE_FLASH_PAGE_SIZE) /**< Start address for persistent data, configurable according to system requirements. */
bogdanm 0:eff01767de02 39 #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 40
bogdanm 0:eff01767de02 41 #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 42 #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 43
bogdanm 0:eff01767de02 44
bogdanm 0:eff01767de02 45 /** Abstracts persistently memory block identifier. */
bogdanm 0:eff01767de02 46 typedef uint32_t pstorage_block_t;
bogdanm 0:eff01767de02 47
bogdanm 0:eff01767de02 48 typedef struct
bogdanm 0:eff01767de02 49 {
bogdanm 0:eff01767de02 50 uint32_t module_id; /**< Module ID.*/
bogdanm 0:eff01767de02 51 pstorage_block_t block_id; /**< Block ID.*/
bogdanm 0:eff01767de02 52 } pstorage_handle_t;
bogdanm 0:eff01767de02 53
bogdanm 0:eff01767de02 54 typedef uint16_t pstorage_size_t; /** Size of length and offset fields. */
bogdanm 0:eff01767de02 55
bogdanm 0:eff01767de02 56 /**@brief Handles Flash Access Result Events. To be called in the system event dispatcher of the application. */
bogdanm 0:eff01767de02 57 void pstorage_sys_event_handler (uint32_t sys_evt);
bogdanm 0:eff01767de02 58
bogdanm 0:eff01767de02 59 #endif // PSTORAGE_PL_H__
bogdanm 0:eff01767de02 60
bogdanm 0:eff01767de02 61 /** @} */
bogdanm 0:eff01767de02 62 /** @endcond */