Committer:
jinu
Date:
Thu Feb 09 06:08:17 2017 +0000
Revision:
0:6ba9b94b8997
NRF51 serialization libraries for mDot

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jinu 0:6ba9b94b8997 1 /* Copyright (c) Nordic Semiconductor ASA
jinu 0:6ba9b94b8997 2 * All rights reserved.
jinu 0:6ba9b94b8997 3 *
jinu 0:6ba9b94b8997 4 * Redistribution and use in source and binary forms, with or without modification,
jinu 0:6ba9b94b8997 5 * are permitted provided that the following conditions are met:
jinu 0:6ba9b94b8997 6 *
jinu 0:6ba9b94b8997 7 * 1. Redistributions of source code must retain the above copyright notice, this
jinu 0:6ba9b94b8997 8 * list of conditions and the following disclaimer.
jinu 0:6ba9b94b8997 9 *
jinu 0:6ba9b94b8997 10 * 2. Redistributions in binary form must reproduce the above copyright notice, this
jinu 0:6ba9b94b8997 11 * list of conditions and the following disclaimer in the documentation and/or
jinu 0:6ba9b94b8997 12 * other materials provided with the distribution.
jinu 0:6ba9b94b8997 13 *
jinu 0:6ba9b94b8997 14 * 3. Neither the name of Nordic Semiconductor ASA nor the names of other
jinu 0:6ba9b94b8997 15 * contributors to this software may be used to endorse or promote products
jinu 0:6ba9b94b8997 16 * derived from this software without specific prior written permission.
jinu 0:6ba9b94b8997 17 *
jinu 0:6ba9b94b8997 18 * 4. This software must only be used in a processor manufactured by Nordic
jinu 0:6ba9b94b8997 19 * Semiconductor ASA, or in a processor manufactured by a third party that
jinu 0:6ba9b94b8997 20 * is used in combination with a processor manufactured by Nordic Semiconductor.
jinu 0:6ba9b94b8997 21 *
jinu 0:6ba9b94b8997 22 *
jinu 0:6ba9b94b8997 23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
jinu 0:6ba9b94b8997 24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
jinu 0:6ba9b94b8997 25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
jinu 0:6ba9b94b8997 26 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
jinu 0:6ba9b94b8997 27 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
jinu 0:6ba9b94b8997 28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
jinu 0:6ba9b94b8997 29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
jinu 0:6ba9b94b8997 30 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
jinu 0:6ba9b94b8997 31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
jinu 0:6ba9b94b8997 32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
jinu 0:6ba9b94b8997 33 */
jinu 0:6ba9b94b8997 34
jinu 0:6ba9b94b8997 35 /**
jinu 0:6ba9b94b8997 36 @defgroup nrf_soc_api SoC Library API
jinu 0:6ba9b94b8997 37 @{
jinu 0:6ba9b94b8997 38
jinu 0:6ba9b94b8997 39 @brief APIs for the SoC library.
jinu 0:6ba9b94b8997 40
jinu 0:6ba9b94b8997 41 */
jinu 0:6ba9b94b8997 42
jinu 0:6ba9b94b8997 43 #ifndef NRF_SOC_H__
jinu 0:6ba9b94b8997 44 #define NRF_SOC_H__
jinu 0:6ba9b94b8997 45
jinu 0:6ba9b94b8997 46 #include <stdint.h>
jinu 0:6ba9b94b8997 47 #include <stdbool.h>
jinu 0:6ba9b94b8997 48 #include "nrf_svc.h"
jinu 0:6ba9b94b8997 49 /** @addtogroup NRF_SOC_DEFINES Defines
jinu 0:6ba9b94b8997 50 * @{ */
jinu 0:6ba9b94b8997 51
jinu 0:6ba9b94b8997 52 /**@brief The number of the lowest SVC number reserved for the SoC library. */
jinu 0:6ba9b94b8997 53 #define SOC_SVC_BASE 0x20
jinu 0:6ba9b94b8997 54
jinu 0:6ba9b94b8997 55
jinu 0:6ba9b94b8997 56 /** @} */
jinu 0:6ba9b94b8997 57
jinu 0:6ba9b94b8997 58 /** @addtogroup NRF_SOC_TYPES Types
jinu 0:6ba9b94b8997 59 * @{ */
jinu 0:6ba9b94b8997 60
jinu 0:6ba9b94b8997 61 /**@brief The SVC numbers used by the SVC functions in the SoC library. */
jinu 0:6ba9b94b8997 62 enum NRF_SOC_SVCS
jinu 0:6ba9b94b8997 63 {
jinu 0:6ba9b94b8997 64 SD_MUTEX_NEW = SOC_SVC_BASE,
jinu 0:6ba9b94b8997 65 SD_MUTEX_ACQUIRE,
jinu 0:6ba9b94b8997 66 SD_MUTEX_RELEASE,
jinu 0:6ba9b94b8997 67 SD_NVIC_ENABLEIRQ,
jinu 0:6ba9b94b8997 68 SD_NVIC_DISABLEIRQ,
jinu 0:6ba9b94b8997 69 SD_NVIC_GETPENDINGIRQ,
jinu 0:6ba9b94b8997 70 SD_NVIC_SETPENDINGIRQ,
jinu 0:6ba9b94b8997 71 SD_NVIC_CLEARPENDINGIRQ,
jinu 0:6ba9b94b8997 72 SD_NVIC_SETPRIORITY,
jinu 0:6ba9b94b8997 73 SD_NVIC_GETPRIORITY,
jinu 0:6ba9b94b8997 74 SD_NVIC_SYSTEMRESET,
jinu 0:6ba9b94b8997 75 SD_NVIC_CRITICAL_REGION_ENTER,
jinu 0:6ba9b94b8997 76 SD_NVIC_CRITICAL_REGION_EXIT,
jinu 0:6ba9b94b8997 77 SD_RAND_APPLICATION_POOL_CAPACITY,
jinu 0:6ba9b94b8997 78 SD_RAND_APPLICATION_BYTES_AVAILABLE,
jinu 0:6ba9b94b8997 79 SD_RAND_APPLICATION_GET_VECTOR,
jinu 0:6ba9b94b8997 80 SD_POWER_MODE_SET,
jinu 0:6ba9b94b8997 81 SD_POWER_SYSTEM_OFF,
jinu 0:6ba9b94b8997 82 SD_POWER_RESET_REASON_GET,
jinu 0:6ba9b94b8997 83 SD_POWER_RESET_REASON_CLR,
jinu 0:6ba9b94b8997 84 SD_POWER_POF_ENABLE,
jinu 0:6ba9b94b8997 85 SD_POWER_POF_THRESHOLD_SET,
jinu 0:6ba9b94b8997 86 SD_POWER_RAMON_SET,
jinu 0:6ba9b94b8997 87 SD_POWER_RAMON_CLR,
jinu 0:6ba9b94b8997 88 SD_POWER_RAMON_GET,
jinu 0:6ba9b94b8997 89 SD_POWER_GPREGRET_SET,
jinu 0:6ba9b94b8997 90 SD_POWER_GPREGRET_CLR,
jinu 0:6ba9b94b8997 91 SD_POWER_GPREGRET_GET,
jinu 0:6ba9b94b8997 92 SD_POWER_DCDC_MODE_SET,
jinu 0:6ba9b94b8997 93 SD_APP_EVT_WAIT,
jinu 0:6ba9b94b8997 94 SD_CLOCK_HFCLK_REQUEST,
jinu 0:6ba9b94b8997 95 SD_CLOCK_HFCLK_RELEASE,
jinu 0:6ba9b94b8997 96 SD_CLOCK_HFCLK_IS_RUNNING,
jinu 0:6ba9b94b8997 97 SD_PPI_CHANNEL_ENABLE_GET,
jinu 0:6ba9b94b8997 98 SD_PPI_CHANNEL_ENABLE_SET,
jinu 0:6ba9b94b8997 99 SD_PPI_CHANNEL_ENABLE_CLR,
jinu 0:6ba9b94b8997 100 SD_PPI_CHANNEL_ASSIGN,
jinu 0:6ba9b94b8997 101 SD_PPI_GROUP_TASK_ENABLE,
jinu 0:6ba9b94b8997 102 SD_PPI_GROUP_TASK_DISABLE,
jinu 0:6ba9b94b8997 103 SD_PPI_GROUP_ASSIGN,
jinu 0:6ba9b94b8997 104 SD_PPI_GROUP_GET,
jinu 0:6ba9b94b8997 105 SD_RADIO_NOTIFICATION_CFG_SET,
jinu 0:6ba9b94b8997 106 SD_ECB_BLOCK_ENCRYPT,
jinu 0:6ba9b94b8997 107 SD_RESERVED1,
jinu 0:6ba9b94b8997 108 SD_RESERVED2,
jinu 0:6ba9b94b8997 109 SD_RESERVED3,
jinu 0:6ba9b94b8997 110 SD_EVT_GET,
jinu 0:6ba9b94b8997 111 SD_TEMP_GET,
jinu 0:6ba9b94b8997 112 SD_FLASH_ERASE_PAGE,
jinu 0:6ba9b94b8997 113 SD_FLASH_WRITE,
jinu 0:6ba9b94b8997 114 SD_FLASH_PROTECT,
jinu 0:6ba9b94b8997 115 SVC_SOC_LAST
jinu 0:6ba9b94b8997 116 };
jinu 0:6ba9b94b8997 117
jinu 0:6ba9b94b8997 118 /**@brief Puts the chip in System OFF mode.
jinu 0:6ba9b94b8997 119 *
jinu 0:6ba9b94b8997 120 * @retval ::NRF_ERROR_SOC_POWER_OFF_SHOULD_NOT_RETURN
jinu 0:6ba9b94b8997 121 */
jinu 0:6ba9b94b8997 122 SVCALL(SD_POWER_SYSTEM_OFF, uint32_t, sd_power_system_off(void));
jinu 0:6ba9b94b8997 123
jinu 0:6ba9b94b8997 124 /**@brief Get the temperature measured on the chip
jinu 0:6ba9b94b8997 125 *
jinu 0:6ba9b94b8997 126 * This function will block until the temperature measurement is done.
jinu 0:6ba9b94b8997 127 * It takes around 50us from call to return.
jinu 0:6ba9b94b8997 128 *
jinu 0:6ba9b94b8997 129 * @note Pan #28 in PAN-028 v 1.6 "Negative measured values are not represented correctly" is corrected by this function.
jinu 0:6ba9b94b8997 130 *
jinu 0:6ba9b94b8997 131 * @param[out] p_temp Result of temperature measurement. Die temperature in 0.25 degrees celsius.
jinu 0:6ba9b94b8997 132 *
jinu 0:6ba9b94b8997 133 * @retval ::NRF_SUCCESS A temperature measurement was done, and the temperature was written to temp
jinu 0:6ba9b94b8997 134 */
jinu 0:6ba9b94b8997 135 SVCALL(SD_TEMP_GET, uint32_t, sd_temp_get(int32_t * p_temp));
jinu 0:6ba9b94b8997 136
jinu 0:6ba9b94b8997 137
jinu 0:6ba9b94b8997 138 /** @} */
jinu 0:6ba9b94b8997 139
jinu 0:6ba9b94b8997 140 #endif // NRF_SOC_H__
jinu 0:6ba9b94b8997 141
jinu 0:6ba9b94b8997 142 /**
jinu 0:6ba9b94b8997 143 @}
jinu 0:6ba9b94b8997 144 */
jinu 0:6ba9b94b8997 145