nRF51 SDK
|
APIs for the SoC library. More...
Modules | |
SoC Library Error Codes | |
Error definitions for the SoC library. | |
Macros | |
#define | SOC_SVC_BASE 0x20 |
The number of the lowest SVC number reserved for the SoC library. | |
#define | NRF_RADIO_NOTIFICATION_INACTIVE_GUARANTEED_TIME_US (62) |
Guranteed time for application to process radio inactive notification. | |
#define | SOC_ECB_KEY_LENGTH (16) |
#define | SOC_ECB_CLEARTEXT_LENGTH (16) |
#define | SOC_ECB_CIPHERTEXT_LENGTH (SOC_ECB_CLEARTEXT_LENGTH) |
#define | SD_EVENT_IRQn (SWI2_IRQn) |
#define | SD_EVENT_IRQHandler (SWI2_IRQHandler) |
#define | RADIO_NOTIFICATION_IRQn (SWI1_IRQn) |
#define | RADIO_NOTIFICATION_IRQHandler (SWI1_IRQHandler) |
Typedefs | |
typedef volatile uint8_t | nrf_mutex_t |
Represents a mutex for use with the nrf_mutex functions. More... | |
typedef uint8_t | nrf_power_mode_t |
Represents a power mode, used in power mode functions. | |
typedef uint8_t | nrf_power_failure_threshold_t |
Represents a power failure threshold value. | |
typedef uint32_t | nrf_power_dcdc_mode_t |
Represents a DCDC mode value. | |
Enumerations | |
enum | { SD_MUTEX_NEW = SOC_SVC_BASE, SD_MUTEX_ACQUIRE, SD_MUTEX_RELEASE, SD_NVIC_ENABLEIRQ, SD_NVIC_DISABLEIRQ, SD_NVIC_GETPENDINGIRQ, SD_NVIC_SETPENDINGIRQ, SD_NVIC_CLEARPENDINGIRQ, SD_NVIC_SETPRIORITY, SD_NVIC_GETPRIORITY, SD_NVIC_SYSTEMRESET, SD_NVIC_CRITICAL_REGION_ENTER, SD_NVIC_CRITICAL_REGION_EXIT, SD_RAND_APPLICATION_POOL_CAPACITY, SD_RAND_APPLICATION_BYTES_AVAILABLE, SD_RAND_APPLICATION_GET_VECTOR, SD_POWER_MODE_SET, SD_POWER_SYSTEM_OFF, SD_POWER_RESET_REASON_GET, SD_POWER_RESET_REASON_CLR, SD_POWER_POF_ENABLE, SD_POWER_POF_THRESHOLD_SET, SD_POWER_RAMON_SET, SD_POWER_RAMON_CLR, SD_POWER_RAMON_GET, SD_POWER_GPREGRET_SET, SD_POWER_GPREGRET_CLR, SD_POWER_GPREGRET_GET, SD_POWER_DCDC_MODE_SET, SD_APP_EVENT_WAIT, SD_CLOCK_HFCLK_REQUEST, SD_CLOCK_HFCLK_RELEASE, SD_CLOCK_HFCLK_IS_RUNNING, SD_PPI_CHANNEL_ENABLE_GET, SD_PPI_CHANNEL_ENABLE_SET, SD_PPI_CHANNEL_ENABLE_CLR, SD_PPI_CHANNEL_ASSIGN, SD_PPI_GROUP_TASK_ENABLE, SD_PPI_GROUP_TASK_DISABLE, SD_PPI_GROUP_ASSIGN, SD_PPI_GROUP_GET, SD_RADIO_NOTIFICATION_CFG_SET, SD_ECB_BLOCK_ENCRYPT, SD_EVENT_GET, SVC_SOC_LAST } |
The SVC numbers used by the SVC functions in the SoC library. | |
enum | { NRF_MUTEX_FREE, NRF_MUTEX_TAKEN } |
Possible values of a nrf_mutex_t. | |
enum | nrf_app_irq_priority_t { NRF_APP_PRIORITY_HIGH = 1, NRF_APP_PRIORITY_LOW = 3, NRF_APP_PRIORITY_HIGH = 1, NRF_APP_PRIORITY_LOW = 3 } |
The interrupt priorities available to the application while the softdevice is active. | |
enum | { NRF_POWER_MODE_CONSTLAT, NRF_POWER_MODE_LOWPWR } |
Possible values of nrf_power_mode_t. More... | |
enum | { NRF_POWER_THRESHOLD_V21, NRF_POWER_THRESHOLD_V23, NRF_POWER_THRESHOLD_V25, NRF_POWER_THRESHOLD_V27 } |
Possible values of nrf_power_failure_threshold_t. More... | |
enum | { NRF_POWER_DCDC_MODE_OFF, NRF_POWER_DCDC_MODE_ON, NRF_POWER_DCDC_MODE_AUTOMATIC } |
Possible values of nrf_power_dcdc_mode_t. More... | |
enum | nrf_radio_notification_distance_t { NRF_RADIO_NOTIFICATION_DISTANCE_NONE = 0, NRF_RADIO_NOTIFICATION_DISTANCE_800US, NRF_RADIO_NOTIFICATION_DISTANCE_1740US, NRF_RADIO_NOTIFICATION_DISTANCE_2680US, NRF_RADIO_NOTIFICATION_DISTANCE_3620US, NRF_RADIO_NOTIFICATION_DISTANCE_4560US, NRF_RADIO_NOTIFICATION_DISTANCE_5500US } |
Radio notification distances. More... | |
enum | nrf_radio_notification_type_t { NRF_RADIO_NOTIFICATION_TYPE_NONE = 0, NRF_RADIO_NOTIFICATION_TYPE_INT_ON_ACTIVE, NRF_RADIO_NOTIFICATION_TYPE_INT_ON_INACTIVE, NRF_RADIO_NOTIFICATION_TYPE_INT_ON_BOTH } |
Radio notification types. More... | |
enum | { NRF_EVENT_HFCLKSTARTED, NRF_EVENT_POWER_FAILURE_WARNING, NRF_EVENT_NUMBER_OF_EVENTS } |
SoC Events. More... | |
Functions | |
uint32_t | sd_mutex_new (nrf_mutex_t *p_mutex) |
Initialize a mutex. More... | |
uint32_t | sd_mutex_acquire (nrf_mutex_t *p_mutex) |
Attempt to acquire a mutex. More... | |
uint32_t | sd_mutex_release (nrf_mutex_t *p_mutex) |
Release a mutex. More... | |
uint32_t | sd_nvic_EnableIRQ (IRQn_Type IRQn) |
Enable External Interrupt. More... | |
uint32_t | sd_nvic_DisableIRQ (IRQn_Type IRQn) |
Disable External Interrupt. More... | |
uint32_t | sd_nvic_GetPendingIRQ (IRQn_Type IRQn, uint32_t *p_pending_irq) |
Get Pending Interrupt. More... | |
uint32_t | sd_nvic_SetPendingIRQ (IRQn_Type IRQn) |
Set Pending Interrupt. More... | |
uint32_t | sd_nvic_ClearPendingIRQ (IRQn_Type IRQn) |
Clear Pending Interrupt. More... | |
uint32_t | sd_nvic_SetPriority (IRQn_Type IRQn, nrf_app_irq_priority_t priority) |
Set Interrupt Priority. More... | |
uint32_t | sd_nvic_GetPriority (IRQn_Type IRQn, nrf_app_irq_priority_t *p_priority) |
Get Interrupt Priority. More... | |
uint32_t | sd_nvic_SystemReset (void) |
System Reset. More... | |
uint32_t | sd_nvic_critical_region_enter (uint8_t *p_is_nested_critical_region) |
Enters critical region. More... | |
uint32_t | sd_nvic_critical_region_exit (uint8_t is_nested_critical_region) |
Exit critical region. More... | |
uint32_t | sd_rand_application_pool_capacity_get (uint8_t *p_pool_capacity) |
Query the capacity of the application random pool. More... | |
uint32_t | sd_rand_application_bytes_available_get (uint8_t *p_bytes_available) |
Get number of random bytes available to the application. More... | |
uint32_t | sd_rand_application_vector_get (uint8_t *p_buff, uint8_t length) |
Get random bytes from the application pool. More... | |
uint32_t | sd_power_reset_reason_get (uint32_t *p_reset_reason) |
Gets the reset reason register. More... | |
uint32_t | sd_power_reset_reason_clr (uint32_t reset_reason_clr_msk) |
Clears the bits of the reset reason register. More... | |
uint32_t | sd_power_mode_set (nrf_power_mode_t power_mode) |
Sets the power mode when in CPU sleep. More... | |
uint32_t | sd_power_system_off (void) |
Puts the chip in System OFF mode. More... | |
uint32_t | sd_power_pof_enable (uint8_t pof_enable) |
Enables or disables the power-fail comparator. More... | |
uint32_t | sd_power_pof_threshold_set (nrf_power_failure_threshold_t threshold) |
Sets the power-fail threshold value. More... | |
uint32_t | sd_power_ramon_set (uint32_t ramon) |
Sets bits in the NRF_POWER->RAMON register. More... | |
uint32_t | sd_power_ramon_clr (uint32_t ramon) |
Clears bits in the NRF_POWER->RAMON register. More... | |
uint32_t | sd_power_ramon_get (uint32_t *p_ramon) |
Get contents of NRF_POWER->RAMON register, indicates power status of ram blocks. More... | |
uint32_t | sd_power_gpregret_set (uint32_t gpregret_msk) |
Set bits in the NRF_POWER->GPREGRET register. More... | |
uint32_t | sd_power_gpregret_clr (uint32_t gpregret_msk) |
Clear bits in the NRF_POWER->GPREGRET register. More... | |
uint32_t | sd_power_gpregret_get (uint32_t *p_gpregret) |
Get contents of the NRF_POWER->GPREGRET register. More... | |
uint32_t | sd_power_dcdc_mode_set (nrf_power_dcdc_mode_t dcdc_mode) |
Sets the DCDC mode. More... | |
uint32_t | sd_clock_hfclk_request (void) |
Request the high frequency crystal oscillator. More... | |
uint32_t | sd_clock_hfclk_release (void) |
Releases the high frequency crystal oscillator. More... | |
uint32_t | sd_clock_hfclk_is_running (uint32_t *p_is_running) |
Checks if the high frequency crystal oscillator is running. More... | |
uint32_t | sd_app_event_wait (void) |
Waits for an application event. More... | |
uint32_t | sd_ppi_channel_enable_get (uint32_t *p_channel_enable) |
Get PPI channel enable register contents. More... | |
uint32_t | sd_ppi_channel_enable_set (uint32_t channel_enable_set_msk) |
Set PPI channel enable register. More... | |
uint32_t | sd_ppi_channel_enable_clr (uint32_t channel_enable_clr_msk) |
Clear PPI channel enable register. More... | |
uint32_t | sd_ppi_channel_assign (uint8_t channel_num, const volatile void *event_endpoint, const volatile void *task_endpoint) |
Assign endpoints to a PPI channel. More... | |
uint32_t | sd_ppi_group_task_enable (uint8_t group_num) |
Task to enable a channel group. More... | |
uint32_t | sd_ppi_group_task_disable (uint8_t group_num) |
Task to disable a channel group. More... | |
uint32_t | sd_ppi_group_assign (uint8_t group_num, uint32_t channel_msk) |
Assign PPI channels to a channel group. More... | |
uint32_t | sd_ppi_group_get (uint8_t group_num, uint32_t *p_channel_msk) |
Gets the PPI channels of a channel group. More... | |
uint32_t | sd_radio_notification_cfg_set (nrf_radio_notification_type_t type, nrf_radio_notification_distance_t distance) |
Configures the Radio Notification signal. More... | |
uint32_t | sd_ecb_block_encrypt (nrf_ecb_hal_data_t *p_ecb_data) |
Encrypts a block according to the specified parameters. More... | |
uint32_t | sd_event_get (uint32_t *p_event) |
Gets any pending events generated by the SoC API. More... | |
Data Structures | |
struct | nrf_ecb_hal_data_t |
AES ECB data structure. More... | |
#define SOC_ECB_KEY_LENGTH (16) |
ECB key length.
#define SOC_ECB_CLEARTEXT_LENGTH (16) |
ECB cleartext length.
#define SOC_ECB_CIPHERTEXT_LENGTH (SOC_ECB_CLEARTEXT_LENGTH) |
ECB ciphertext length.
#define SD_EVENT_IRQn (SWI2_IRQn) |
SoftDevice Event IRQ number. Used for both protocol events and SoC events.
#define SD_EVENT_IRQHandler (SWI2_IRQHandler) |
SoftDevice Event IRQ handler. Used for both protocol events and SoC events.
#define RADIO_NOTIFICATION_IRQn (SWI1_IRQn) |
The radio notification IRQ number.
#define RADIO_NOTIFICATION_IRQHandler (SWI1_IRQHandler) |
The radio notification IRQ handler.
typedef volatile uint8_t nrf_mutex_t |
anonymous enum |
anonymous enum |
anonymous enum |
anonymous enum |
uint32_t sd_mutex_new | ( | nrf_mutex_t * | p_mutex | ) |
[in] | p_mutex | Pointer to the mutex to initialize. |
uint32_t sd_mutex_acquire | ( | nrf_mutex_t * | p_mutex | ) |
[in] | p_mutex | Pointer to the mutex to acquire. |
uint32_t sd_mutex_release | ( | nrf_mutex_t * | p_mutex | ) |
[in] | p_mutex | Pointer to the mutex to release. |
uint32_t sd_nvic_EnableIRQ | ( | IRQn_Type | IRQn | ) |
[in] | IRQn | See the NVIC_EnableIRQ documentation in CMSIS. |
uint32_t sd_nvic_DisableIRQ | ( | IRQn_Type | IRQn | ) |
[in] | IRQn | See the NVIC_DisableIRQ documentation in CMSIS |
uint32_t sd_nvic_GetPendingIRQ | ( | IRQn_Type | IRQn, |
uint32_t * | p_pending_irq | ||
) |
[in] | IRQn | See the NVIC_GetPendingIRQ documentation in CMSIS. |
[out] | p_pending_irq | Return value from NVIC_GetPendingIRQ. |
uint32_t sd_nvic_SetPendingIRQ | ( | IRQn_Type | IRQn | ) |
[in] | IRQn | See the NVIC_SetPendingIRQ documentation in CMSIS. |
uint32_t sd_nvic_ClearPendingIRQ | ( | IRQn_Type | IRQn | ) |
[in] | IRQn | See the NVIC_ClearPendingIRQ documentation in CMSIS. |
uint32_t sd_nvic_SetPriority | ( | IRQn_Type | IRQn, |
nrf_app_irq_priority_t | priority | ||
) |
[in] | IRQn | See the NVIC_SetPriority documentation in CMSIS. |
[in] | priority | A valid IRQ priority for use by the application. |
uint32_t sd_nvic_GetPriority | ( | IRQn_Type | IRQn, |
nrf_app_irq_priority_t * | p_priority | ||
) |
[in] | IRQn | See the NVIC_GetPriority documentation in CMSIS. |
[out] | p_priority | Return value from NVIC_GetPriority. |
uint32_t sd_nvic_SystemReset | ( | void | ) |
uint32_t sd_nvic_critical_region_enter | ( | uint8_t * | p_is_nested_critical_region | ) |
[out] | p_is_nested_critical_region | 1: If in a nested critical region. 0: Otherwise. |
uint32_t sd_nvic_critical_region_exit | ( | uint8_t | is_nested_critical_region | ) |
[in] | is_nested_critical_region | If this is set to 1, the critical region won't be exited. |
uint32_t sd_rand_application_pool_capacity_get | ( | uint8_t * | p_pool_capacity | ) |
[out] | p_pool_capacity | The capacity of the pool. |
uint32_t sd_rand_application_bytes_available_get | ( | uint8_t * | p_bytes_available | ) |
[out] | p_bytes_available | The number of bytes currently available in the pool. |
uint32_t sd_rand_application_vector_get | ( | uint8_t * | p_buff, |
uint8_t | length | ||
) |
[out] | p_buff | Pointer to unit8_t buffer for storing the bytes. |
[in] | length | Number of bytes to take from pool and place in p_buff. |
uint32_t sd_power_reset_reason_get | ( | uint32_t * | p_reset_reason | ) |
[out] | p_reset_reason | Contents of the NRF_POWER->RESETREAS register. |
uint32_t sd_power_reset_reason_clr | ( | uint32_t | reset_reason_clr_msk | ) |
[in] | reset_reason_clr_msk | Contains the bits to clear from the reset reason register. |
uint32_t sd_power_mode_set | ( | nrf_power_mode_t | power_mode | ) |
[in] | power_mode | The power mode to use when in CPU sleep. |
uint32_t sd_power_system_off | ( | void | ) |
uint32_t sd_power_pof_enable | ( | uint8_t | pof_enable | ) |
Enabling this will give a softdevice event (NRF_EVENT_POWER_FAILURE_WARNING) when the power failure warning occurs. The event can be retrived with sd_event_get();
[in] | pof_enable | True if the power-fail comparator should be enabled, false if it should be disabled. |
uint32_t sd_power_pof_threshold_set | ( | nrf_power_failure_threshold_t | threshold | ) |
[in] | threshold | The power-fail threshold value to use. |
uint32_t sd_power_ramon_set | ( | uint32_t | ramon | ) |
[in] | ramon | Contains the bits needed to be set in the NRF_POWER->RAMON register. |
uint32_t sd_power_ramon_clr | ( | uint32_t | ramon | ) |
ramon | Contains the bits needed to be cleared in the NRF_POWER->RAMON register. |
uint32_t sd_power_ramon_get | ( | uint32_t * | p_ramon | ) |
[out] | p_ramon | Content of NRF_POWER->RAMON register. |
uint32_t sd_power_gpregret_set | ( | uint32_t | gpregret_msk | ) |
[in] | gpregret_msk | Bits to be set in the GPREGRET register. |
uint32_t sd_power_gpregret_clr | ( | uint32_t | gpregret_msk | ) |
[in] | gpregret_msk | Bits to be clear in the GPREGRET register. |
uint32_t sd_power_gpregret_get | ( | uint32_t * | p_gpregret | ) |
[out] | p_gpregret | Contents of the GPREGRET register. |
uint32_t sd_power_dcdc_mode_set | ( | nrf_power_dcdc_mode_t | dcdc_mode | ) |
Depending on the internal state of the SoftDevice, the mode change may not happen immediately. The DCDC mode switch will be blocked when occuring in close proximity to radio transmissions. When the radio transmission is done, the last mode will be used.
[in] | dcdc_mode | The mode of the DCDC. |
uint32_t sd_clock_hfclk_request | ( | void | ) |
Will start the high frequency crystal oscillator, the startup time of the crystal varies and the sd_clock_hfclk_is_running function can be polled to check if it has started.
uint32_t sd_clock_hfclk_release | ( | void | ) |
Will stop the high frequency crystal oscillator, this happens immediately.
uint32_t sd_clock_hfclk_is_running | ( | uint32_t * | p_is_running | ) |
[out] | p_is_running | 1 if the external crystal oscillator is running, 0 if not. |
uint32_t sd_app_event_wait | ( | void | ) |
An application event is either an application interrupt or a pended interrupt when the interrupt is disabled. When the interrupt is enabled it will be taken immediately since this function will wait in thread mode, then the execution will return in the application's main thread. When an interrupt is disabled and gets pended it will return to the application's thread main. The application must ensure that the pended flag is cleared using sd_nvic_ClearPendingIRQ in order to sleep using this function. This is only necessary for disabled interrupts, as the interrupt handler will clear the pending flag automatically for enabled interrupts.
In order to wake up from disabled interrupts, the SEVONPEND flag has to be set in the Cortex-M0 System Control Register (SCR).
uint32_t sd_ppi_channel_enable_get | ( | uint32_t * | p_channel_enable | ) |
[out] | p_channel_enable | The contents of the PPI CHEN register. |
uint32_t sd_ppi_channel_enable_set | ( | uint32_t | channel_enable_set_msk | ) |
[in] | channel_enable_set_msk | Mask containing the bits to set in the PPI CHEN register. |
uint32_t sd_ppi_channel_enable_clr | ( | uint32_t | channel_enable_clr_msk | ) |
[in] | channel_enable_clr_msk | Mask containing the bits to clear in the PPI CHEN register. |
uint32_t sd_ppi_channel_assign | ( | uint8_t | channel_num, |
const volatile void * | event_endpoint, | ||
const volatile void * | task_endpoint | ||
) |
[in] | channel_num | Number of the PPI channel to assign. |
[in] | event_endpoint | Event endpoint of the PPI channel. |
[in] | task_endpoint | Task endpoint of the PPI channel. |
uint32_t sd_ppi_group_task_enable | ( | uint8_t | group_num | ) |
[in] | group_num | Number of the channel group. |
uint32_t sd_ppi_group_task_disable | ( | uint8_t | group_num | ) |
[in] | group_num | Number of the PPI group. |
uint32_t sd_ppi_group_assign | ( | uint8_t | group_num, |
uint32_t | channel_msk | ||
) |
[in] | group_num | Number of the channel group. |
[in] | channel_msk | Mask of the channels to assign to the group. |
uint32_t sd_ppi_group_get | ( | uint8_t | group_num, |
uint32_t * | p_channel_msk | ||
) |
[in] | group_num | Number of the channel group. |
[out] | p_channel_msk | Mask of the channels assigned to the group. |
uint32_t sd_radio_notification_cfg_set | ( | nrf_radio_notification_type_t | type, |
nrf_radio_notification_distance_t | distance | ||
) |
[in] | type | Type of notification signal. NRF_RADIO_NOTIFICATION_TYPE_NONE shall be used to turn off radio notification. Using NRF_RADIO_NOTIFICATION_DISTANCE_NONE is recommended (but not required) to be used with NRF_RADIO_NOTIFICATION_TYPE_NONE. |
[in] | distance | Distance between the notification signal and start of radio activity. This parameter is ignored when NRF_RADIO_NOTIFICATION_TYPE_NONE or NRF_RADIO_NOTIFICATION_TYPE_INT_ON_INACTIVE is used. |
uint32_t sd_ecb_block_encrypt | ( | nrf_ecb_hal_data_t * | p_ecb_data | ) |
128-bit AES encryption.
[in,out] | p_ecb_data | Pointer to the ECB paramters' struct (two input parameters and one output parameter). |
uint32_t sd_event_get | ( | uint32_t * | p_event | ) |
The application should keep calling this function to get events, until NRF_ERROR_NOT_FOUND is returned.
[out] | p_event | Set to the event number, if any events are pending. |