NRF5: changes for code review of merg nrf52840 to NRF5 sources

s140 headers renamed form ble_* to nrf_ble_*,
Removed s130 and s132 headers named form ble_*
(Them had been added by #2ff572682798562e812015dc775b5896e0fda5a4)
Headers inclusinons were changed in order to meet above changes.

Revrted bad change in us_ticker.c:
use __disable_irq lock instead of core_util_critical_section_enter lock
for setting rtc1 tick for systick emulation as was good before.
pull/4245/head
Andrzej Puzdrowski 2017-05-09 15:41:03 +02:00
parent 382a067d4f
commit 1f1168a51e
74 changed files with 99 additions and 118 deletions

View File

@ -50,7 +50,7 @@ extern "C" {
#include "ble_stack_handler_types.h"
}
#include "ble_hci.h"
#include "nrf_ble_hci.h"
#include "btle_discovery.h"
#include "nRF5xGattClient.h"

View File

@ -24,7 +24,7 @@ extern "C" {
#include "common/common.h"
#include "ble_srv_common.h"
#include "headers/ble.h"
#include "headers/nrf_ble.h"
error_t btle_init(void);

View File

@ -15,7 +15,7 @@
*/
#include "common/common.h"
#include "ble_gap.h"
#include "headers/nrf_ble_gap.h"
#include "ble_conn_params.h"
static inline uint32_t msec_to_1_25msec(uint32_t interval_ms) ATTR_ALWAYS_INLINE ATTR_CONST;

View File

@ -18,7 +18,7 @@
#define _CUSTOM_HELPER_H_
#include "common/common.h"
#include "headers/ble.h"
#include "headers/nrf_ble.h"
#include "ble/UUID.h"
#include "ble/GattCharacteristic.h"

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
#include "nRF5xCharacteristicDescriptorDiscoverer.h"
#include "ble_err.h"
#include "headers/nrf_ble_err.h"
#include "ble/DiscoveredCharacteristicDescriptor.h"
nRF5xCharacteristicDescriptorDiscoverer::nRF5xCharacteristicDescriptorDiscoverer() :

View File

@ -21,7 +21,7 @@
#include "ble/DiscoveredCharacteristic.h"
#include "ble/CharacteristicDescriptorDiscovery.h"
#include "ble/GattClient.h"
#include "ble_gattc.h"
#include "headers/nrf_ble_gattc.h"
/**
* @brief Manage the discovery of Characteristic descriptors

View File

@ -16,7 +16,7 @@
#include "nRF5xDiscoveredCharacteristic.h"
#include "nRF5xGattClient.h"
#include "ble_gatt.h"
#include "headers/nrf_ble_gatt.h"
void
nRF5xDiscoveredCharacteristic::setup(nRF5xGattClient *gattcIn,

View File

@ -18,7 +18,7 @@
#define __NRF_DISCOVERED_CHARACTERISTIC_H__
#include "ble/DiscoveredCharacteristic.h"
#include "ble_gatt.h"
#include "headers/nrf_ble_gatt.h"
class nRF5xGattClient; /* forward declaration */

View File

@ -24,7 +24,7 @@
#include "common/common.h"
#include "ble_advdata.h"
#include "ble_hci.h"
#include "headers/nrf_ble_hci.h"
#if (NRF_SD_BLE_API_VERSION >= 3)
#include "peer_manager.h"
@ -141,6 +141,9 @@ ble_error_t nRF5xGap::setAdvertisingData(const GapAdvertisingData &advData, cons
/**************************************************************************/
ble_error_t nRF5xGap::startAdvertising(const GapAdvertisingParams &params)
{
uint32_t err;
ble_gap_adv_params_t adv_para = {0};
/* Make sure we support the advertising type */
if (params.getAdvertisingType() == GapAdvertisingParams::ADV_CONNECTABLE_DIRECTED) {
/* ToDo: This requires a propery security implementation, etc. */
@ -173,10 +176,7 @@ ble_error_t nRF5xGap::startAdvertising(const GapAdvertisingParams &params)
(params.getTimeout() > GapAdvertisingParams::GAP_ADV_PARAMS_TIMEOUT_MAX)) {
return BLE_ERROR_PARAM_OUT_OF_RANGE;
}
uint32_t err;
ble_gap_adv_params_t adv_para = {0};
#if (NRF_SD_BLE_API_VERSION <= 2)
/* Allocate the stack's whitelist statically */
ble_gap_whitelist_t whitelist;

View File

@ -39,7 +39,7 @@
#define YOTTA_CFG_IRK_TABLE_MAX_SIZE BLE_GAP_WHITELIST_IRK_MAX_COUNT
#endif
#include "ble/blecommon.h"
#include "headers/ble.h"
#include "headers/nrf_ble.h"
#include "ble/GapAdvertisingParams.h"
#include "ble/GapAdvertisingData.h"
#include "ble/Gap.h"

View File

@ -20,7 +20,7 @@
#include <stddef.h>
#include "ble/blecommon.h"
#include "headers/ble.h" /* nordic ble */
#include "headers/nrf_ble.h" /* nordic ble */
#include "ble/Gap.h"
#include "ble/GattServer.h"

View File

@ -21,8 +21,8 @@
#include "ble/DiscoveredService.h"
#include "nRF5xDiscoveredCharacteristic.h"
#include "headers/ble.h"
#include "ble_gattc.h"
#include "headers/nrf_ble.h"
#include "headers/nrf_ble_gattc.h"
class nRF5xGattClient; /* forward declaration */

View File

@ -49,13 +49,13 @@
#ifndef BLE_H__
#define BLE_H__
#include "ble_ranges.h"
#include "ble_types.h"
#include "ble_gap.h"
#include "ble_l2cap.h"
#include "ble_gatt.h"
#include "ble_gattc.h"
#include "ble_gatts.h"
#include "nrf_ble_ranges.h"
#include "nrf_ble_types.h"
#include "nrf_ble_gap.h"
#include "nrf_ble_l2cap.h"
#include "nrf_ble_gatt.h"
#include "nrf_ble_gattc.h"
#include "nrf_ble_gatts.h"
#ifdef __cplusplus
extern "C" {

View File

@ -45,8 +45,8 @@
#ifndef BLE_GAP_H__
#define BLE_GAP_H__
#include "ble_types.h"
#include "ble_ranges.h"
#include "nrf_ble_types.h"
#include "nrf_ble_ranges.h"
#include "nrf_svc.h"
#ifdef __cplusplus

View File

@ -45,8 +45,8 @@
#ifndef BLE_GATT_H__
#define BLE_GATT_H__
#include "ble_types.h"
#include "ble_ranges.h"
#include "nrf_ble_types.h"
#include "nrf_ble_ranges.h"
#ifdef __cplusplus
extern "C" {

View File

@ -45,9 +45,9 @@
#ifndef BLE_GATTC_H__
#define BLE_GATTC_H__
#include "ble_gatt.h"
#include "ble_types.h"
#include "ble_ranges.h"
#include "nrf_ble_gatt.h"
#include "nrf_ble_types.h"
#include "nrf_ble_ranges.h"
#include "nrf_svc.h"
#include "nrf_error.h"
#include "nrf.h"

View File

@ -45,11 +45,11 @@
#ifndef BLE_GATTS_H__
#define BLE_GATTS_H__
#include "ble_types.h"
#include "ble_ranges.h"
#include "ble_l2cap.h"
#include "ble_gap.h"
#include "ble_gatt.h"
#include "nrf_ble_types.h"
#include "nrf_ble_ranges.h"
#include "nrf_ble_l2cap.h"
#include "nrf_ble_gap.h"
#include "nrf_ble_gatt.h"
#include "nrf_svc.h"
#ifdef __cplusplus

View File

@ -45,9 +45,9 @@
#ifndef BLE_L2CAP_H__
#define BLE_L2CAP_H__
#include "ble_types.h"
#include "ble_ranges.h"
#include "ble_err.h"
#include "nrf_ble_types.h"
#include "nrf_ble_ranges.h"
#include "nrf_ble_err.h"
#include "nrf_svc.h"
#ifdef __cplusplus

View File

@ -62,8 +62,8 @@
#include <stdint.h>
#include "nrf_error.h"
#include "headers/ble.h"
#include "ble_gattc.h"
#include "headers/nrf_ble.h"
#include "headers/nrf_ble_gattc.h"
#include "ble_advdata.h"
#ifdef __cplusplus

View File

@ -40,7 +40,7 @@
#if NRF_MODULE_ENABLED(BLE_DB_DISCOVERY)
#include "ble_db_discovery.h"
#include <stdlib.h>
#include "headers\ble.h"
#include "headers/nrf_ble.h"
#include "ble_srv_common.h"
#define NRF_LOG_MODULE_NAME "BLE_DB_DISC"
#include "nrf_log.h"

View File

@ -70,8 +70,8 @@
#include <stdint.h>
#include "nrf_error.h"
#include "headers\ble.h"
#include "ble_gattc.h"
#include "headers/nrf_ble.h"
#include "headers/nrf_ble_gattc.h"
#include "ble_srv_common.h"
#include "ble_gatt_db.h"

View File

@ -49,8 +49,8 @@
#include <stdint.h>
#include <stdbool.h>
#include "headers\ble.h"
#include "ble_types.h"
#include "headers/nrf_ble.h"
#include "headers/nrf_ble_types.h"
#ifdef __cplusplus
extern "C" {

View File

@ -37,7 +37,7 @@
*/
#include "ble_advdata.h"
#include "ble_gap.h"
#include "headers/nrf_ble_gap.h"
#include "ble_srv_common.h"
#include "sdk_common.h"

View File

@ -51,7 +51,7 @@
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include "headers/ble.h"
#include "headers/nrf_ble.h"
#include "app_util.h"
#ifdef __cplusplus

View File

@ -48,7 +48,7 @@
#define BLE_CONN_PARAMS_H__
#include <stdint.h>
#include "headers/ble.h"
#include "headers/nrf_ble.h"
#include "ble_srv_common.h"
#ifdef __cplusplus

View File

@ -40,7 +40,7 @@
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include "headers/ble.h"
#include "headers/nrf_ble.h"
#include "sdk_mapped_flags.h"
#include "app_error.h"

View File

@ -68,7 +68,7 @@
#include <stdbool.h>
#include <stdint.h>
#include "headers/ble.h"
#include "headers/nrf_ble.h"
#include "sdk_mapped_flags.h"
#ifdef __cplusplus

View File

@ -47,8 +47,8 @@
#define BLE_GATT_DB_H__
#include <stdint.h>
#include "headers/ble.h"
#include "ble_gattc.h"
#include "headers/nrf_ble.h"
#include "headers/nrf_ble_gattc.h"
#ifdef __cplusplus
extern "C" {

View File

@ -45,7 +45,7 @@
#include <string.h>
#include "nordic_common.h"
#include "app_error.h"
#include "headers/ble.h"
#include "headers/nrf_ble.h"
bool ble_srv_is_notification_enabled(uint8_t const * p_encoded_data)
{

View File

@ -49,11 +49,11 @@
#include <stdint.h>
#include <stdbool.h>
#include "ble_types.h"
#include "headers/nrf_ble_types.h"
#include "app_util.h"
#include "headers/ble.h"
#include "ble_gap.h"
#include "ble_gatt.h"
#include "headers/nrf_ble.h"
#include "headers/nrf_ble_gap.h"
#include "headers/nrf_ble_gatt.h"
#ifdef __cplusplus
extern "C" {

View File

@ -40,7 +40,7 @@
#if NRF_MODULE_ENABLED(PEER_MANAGER)
#include "gatt_cache_manager.h"
#include "ble_gap.h"
#include "headers/nrf_ble_gap.h"
#include "ble_conn_state.h"
#include "peer_manager_types.h"
#include "peer_manager_internal.h"

View File

@ -42,8 +42,8 @@
#include <stdint.h>
#include "sdk_errors.h"
#include "headers/ble.h"
#include "ble_gap.h"
#include "headers/nrf_ble.h"
#include "headers/nrf_ble_gap.h"
#include "peer_manager_types.h"
#ifdef __cplusplus

View File

@ -41,7 +41,7 @@
#include "gatts_cache_manager.h"
#include <string.h>
#include "ble_gap.h"
#include "headers/nrf_ble_gap.h"
#include "peer_manager_types.h"
#include "peer_manager_internal.h"
#include "peer_database.h"

View File

@ -42,8 +42,8 @@
#include <stdint.h>
#include "sdk_errors.h"
#include "headers/ble.h"
#include "ble_gap.h"
#include "headers/nrf_ble.h"
#include "headers/nrf_ble_gap.h"
#include "peer_manager_types.h"
#ifdef __cplusplus

View File

@ -41,8 +41,8 @@
#include "id_manager.h"
#include <string.h>
#include "headers/ble.h"
#include "ble_gap.h"
#include "headers/nrf_ble.h"
#include "headers/nrf_ble_gap.h"
#include "ble_conn_state.h"
#include "peer_manager_types.h"
#include "peer_database.h"

View File

@ -42,8 +42,8 @@
#include <stdint.h>
#include "sdk_errors.h"
#include "headers/ble.h"
#include "ble_gap.h"
#include "headers/nrf_ble.h"
#include "headers/nrf_ble_gap.h"
#include "peer_manager_types.h"
#ifdef __cplusplus

View File

@ -43,7 +43,7 @@
#include <stdint.h>
#include "sdk_errors.h"
#include "ble_gap.h"
#include "headers/nrf_ble_gap.h"
#include "peer_manager_types.h"
#include "peer_manager_internal.h"

View File

@ -43,7 +43,7 @@
#include <stdint.h>
#include "sdk_errors.h"
#include "ble_gap.h"
#include "headers/nrf_ble_gap.h"
#include "peer_manager_types.h"
#ifdef __cplusplus

View File

@ -62,8 +62,8 @@
#include <stdint.h>
#include <stdbool.h>
#include "sdk_common.h"
#include "headers/ble.h"
#include "ble_gap.h"
#include "headers/nrf_ble.h"
#include "headers/nrf_ble_gap.h"
#include "peer_manager_types.h"
#include "peer_database.h"

View File

@ -42,8 +42,8 @@
#include <stdint.h>
#include "sdk_errors.h"
#include "headers/ble.h"
#include "ble_gap.h"
#include "headers/nrf_ble.h"
#include "headers/nrf_ble_gap.h"
#include "peer_manager_types.h"
#ifdef __cplusplus

View File

@ -51,8 +51,8 @@
#include <stdbool.h>
#include <stddef.h>
#include "nrf.h"
#include "ble_gap.h"
#include "ble_hci.h"
#include "headers/nrf_ble_gap.h"
#include "headers/nrf_ble_hci.h"
#include "ble_gatt_db.h"
#include "app_util.h"
#include "app_util_platform.h"

View File

@ -41,8 +41,8 @@
#include "security_dispatcher.h"
#include <string.h>
#include "headers/ble.h"
#include "ble_gap.h"
#include "headers/nrf_ble.h"
#include "headers/nrf_ble_gap.h"
#include "ble_conn_state.h"
#include "peer_manager_types.h"
#include "peer_database.h"

View File

@ -42,8 +42,8 @@
#include <stdint.h>
#include "sdk_errors.h"
#include "headers/ble.h"
#include "ble_gap.h"
#include "headers/nrf_ble.h"
#include "headers/nrf_ble_gap.h"
#include "peer_manager_types.h"
#ifdef __cplusplus

View File

@ -42,8 +42,8 @@
#include <stdint.h>
#include "sdk_errors.h"
#include "headers/ble.h"
#include "ble_gap.h"
#include "headers/nrf_ble.h"
#include "headers/nrf_ble_gap.h"
#include "peer_manager_types.h"
#include "security_dispatcher.h"

View File

@ -55,7 +55,7 @@ extern "C" {
#ifdef BLE_STACK_SUPPORT_REQD
#include <stdlib.h>
#include "headers/ble.h"
#include "headers/nrf_ble.h"
#include "nrf_sdm.h"
#include "app_error.h"
#include "app_util.h"

View File

@ -62,7 +62,7 @@
#elif defined(ANT_STACK_SUPPORT_REQD)
#include "ant_interface.h"
#elif defined(BLE_STACK_SUPPORT_REQD)
#include "headers/ble.h"
#include "headers/nrf_ble.h"
#endif
#define RAM_START_ADDRESS 0x20000000

View File

@ -66,7 +66,7 @@
#include "ble_stack_handler_types.h"
#include "ant_stack_handler_types.h"
#if defined(BLE_STACK_SUPPORT_REQD)
#include "headers/ble.h"
#include "headers/nrf_ble.h"
#endif
#include "app_ram_base.h"

View File

@ -56,7 +56,7 @@ static gpio_cfg_t m_gpio_cfg[GPIO_PIN_COUNT];
static gpio_irq_handler m_irq_handler;
static uint32_t m_channel_ids[GPIO_PIN_COUNT] = {0};
static uint32_t m_gpio_irq_enabled;
static gpio_mask_t m_gpio_irq_enabled;
static void gpiote_irq_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
@ -90,6 +90,7 @@ void gpio_init(gpio_t *obj, PinName pin)
}
#ifdef TARGET_SDK11
// implement polyfill of gpio hal for the nRF5 SDK v11
__STATIC_INLINE uint32_t nrf_gpio_pin_out_read(uint32_t pin)
{
return (NRF_GPIO->OUTSET & (1UL << (pin)));

View File

@ -55,7 +55,7 @@ static NRF_GPIO_Type * const m_ports[] = GPIO_REG_LIST;
#error not recognized gpio count for mcu
#endif
#define GPIO_PORT_COUNT (sizeof(m_gpio_pin_count)/sizeof(uint32_t))
#define GPIO_PORT_COUNT (sizeof(m_gpio_pin_count)/sizeof(m_gpio_pin_count[0]))
PinName port_pin(PortName port, int pin_n)

View File

@ -139,10 +139,10 @@ void common_rtc_init(void)
// energy efficient).
nrf_rtc_int_enable(COMMON_RTC_INSTANCE,
#if DEVICE_LOWPOWERTIMER
LP_TICKER_INT_MASK |
LP_TICKER_INT_MASK |
#endif
US_TICKER_INT_MASK |
NRF_RTC_INT_OVERFLOW_MASK);
US_TICKER_INT_MASK |
NRF_RTC_INT_OVERFLOW_MASK);
// This event is enabled permanently, since overflow indications are needed
// continuously.
@ -150,20 +150,20 @@ void common_rtc_init(void)
// All other relevant events are initially disabled.
nrf_rtc_event_disable(COMMON_RTC_INSTANCE,
#if defined(TARGET_MCU_NRF51822)
OS_TICK_INT_MASK |
OS_TICK_INT_MASK |
#endif
#if DEVICE_LOWPOWERTIMER
LP_TICKER_INT_MASK |
LP_TICKER_INT_MASK |
#endif
US_TICKER_INT_MASK);
US_TICKER_INT_MASK);
nrf_drv_common_irq_enable(nrf_drv_get_IRQn(COMMON_RTC_INSTANCE),
#ifdef NRF51
APP_IRQ_PRIORITY_LOW
APP_IRQ_PRIORITY_LOW
#elif defined(NRF52) || defined(NRF52840_XXAA)
APP_IRQ_PRIORITY_LOWEST
APP_IRQ_PRIORITY_LOWEST
#endif
);
);
nrf_rtc_task_trigger(COMMON_RTC_INSTANCE, NRF_RTC_TASK_START);
@ -542,7 +542,7 @@ static void register_next_tick()
// the RTC1 keeps running.
// This code is very short 20-38 cycles in the worst case, it shouldn't
// disturb softdevice.
core_util_critical_section_enter();
__disable_irq();
uint32_t current_counter = nrf_rtc_counter_get(COMMON_RTC_INSTANCE);
// If an overflow occur, set the next tick in COUNTER + delta clock cycles
@ -553,7 +553,7 @@ static void register_next_tick()
// Enable generation of the compare event for the value set above (this
// event will trigger the interrupt).
nrf_rtc_event_enable(COMMON_RTC_INSTANCE, OS_TICK_INT_MASK);
core_util_critical_section_exit();
__enable_irq();
}
/**